Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add required prop to ui.file_upload #1633

Merged
merged 5 commits into from
Sep 26, 2022
Merged

feat: Add required prop to ui.file_upload #1633

merged 5 commits into from
Sep 26, 2022

Conversation

marek-mihok
Copy link
Contributor

@marek-mihok marek-mihok commented Sep 21, 2022

Adds required prop to ui.file_upload component. Updated API:

export interface FileUpload {
  /** An identifying name for this component. */
  name: Id
  /** Text to be displayed in the bottom button or as a component title when the component is displayed compactly. Defaults to "Upload". */
  label?: S
  /** True if the component should allow multiple files to be uploaded. */
  multiple?: B
  /** List of allowed file extensions, e.g. `pdf`, `docx`, etc. */
  file_extensions?: S[]
  /** Maximum allowed size (Mb) per file. No limit by default. */
  max_file_size?: F
  /** Maximum allowed size (Mb) for all files combined. No limit by default. */
  max_size?: F
  /** The height of the file upload, e.g. '400px', '50%', etc. Defaults to 300px. */
  height?: S
  /** The width of the file upload, e.g. '100px'. Defaults to '100%'. */
  width?: S
  /** True if the component should be displayed compactly (without drag-and-drop capabilities). Defaults to False. */
  compact?: B
  /** True if the component should be visible. Defaults to True. */
  visible?: B
  /** An optional tooltip message displayed when a user clicks the help icon to the right of the component. */
  tooltip?: S
  /** True if this is a required field. Defaults to False. */
  required?: B
}

Full-sized:
image

Compact (with label):
image

Compact (without label):
image

Closes #1503

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @marek-mihok! Let's put the asterisk in compact mode next to the label (similar to how textbox/dropdown works. As for the large version, let's go with the current implementation, can be revisited in #1049.

ui/src/file_upload.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 more questions and we are good to go.

ui/src/file_upload.tsx Outdated Show resolved Hide resolved
ui/src/file_upload.tsx Show resolved Hide resolved
@mturoci mturoci merged commit bca7d7c into master Sep 26, 2022
@mturoci mturoci deleted the feat/issue-1503 branch September 26, 2022 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

file_upload required parameter
2 participants