File Input

Allows the user to upload one or multiple files from their device. Uploads are initiated via the native OS file picker.

Use File Input...

  • For uploading one or more files.
  • When space on a page is limited.
  • The upload functionality is not the primary action on a view/page.

Don't use File Input...

  • For most use cases. Use File Dropzone instead as this provides the affordance of drag and drop.
  • To show the progress of uploading. Use File Tile instead.

Default

File Input is built upon the native HTML <input type="file"> element, so it can accept all of the native input’s events and attributes, including onChange to get the contents of the uploaded file, or multiple to let the user select multiple files.

The File Input Label sub-component is the visible part, since we hide the native <input> and only show this <label>. For accessibility, it must have accessible text, such as visible HTML text, visually-hidden text, alt text on an image, or an aria-label.

The preview has been updated.

Inside of a Form

Since it is an input element, File Input can be used inside of a FormInputGroup along with a separate, external label and/or helper text. Helper text should display upload criteria such as accepted file formats and maximum file size.

The preview has been updated.

Button variants

File Upload Label is a <label>, but it accepts many of the visual props from Button. You can use these to customize the appearance of the label.

Available props are skin, sizeVariant, size, widthVariant, width, specialVariant, iconPosition, and buttonShape.

The preview has been updated.

Disabled

Use disabled when a File Input's action is unavailable.

The preview has been updated.

File Upload pattern

File Input is part of a larger pattern of uploading files. The File Upload pattern ensures users are presented with a consistent UI regardless of the file types uploaded or the specific page navigated to.

For more information, see File Upload.

The preview has been updated.

Props

See core props for additional props that can be applied to each of these components. Each component also accepts the React-equivalent native HTML attributes of the element it renders, unless a listed prop replaces one or a note says otherwise.
FileInput
Renders <input>. No props beyond core props and native HTML attributes.
FileInputLabel
Renders <label>.
proptyperequireddefaultdeprecation notes
width
The width variation
"standard""full-width"⚠️ "wide"null
false
standard
Deprecated values:
  • wide: Use default width or "full-width" for container-width buttons. Note: Neither option will exactly match the previous "wide" behavior.
⚠️ Deprecated
size
The size variation @deprecated This is deprecated without a replacement.
"standard""mini"null
false
standard
This is deprecated without a replacement.
skin
The visual style of the Button
"link""primary""secondary""unstyled""tertiary""clear-selection""destructive-primary""destructive-secondary""destructive-tertiary"null
false
secondary
⚠️ Deprecated
specialVariant
Variations for special cases @deprecated This is deprecated without a replacement.
"standard""design-path"null
false
standard
This is deprecated without a replacement.
iconPosition
The position of the icon in the Button
"left""right"null
false
null
⚠️ Deprecated
buttonShape
The shape of the Button - use `round` for icon buttons @deprecated Use `IconButton` component for creating icon-only buttons
"standard""round"null
false
standard
Use `IconButton` component for creating icon-only buttons

Related