Usage
FileInput component supports Input and Input.Wrapper components features and all input element props. FileInput documentation does not include all features supported by the component – see Input documentation to learn about all available features.
Input description
Controlled
When multiple is false:
When multiple is true:
Multiple
Set multiple to allow user to pick more than one file:
Accept
Set accept prop to restrict files selection to specific mime types:
Clearable
Set clearable prop to display clear button in the right section of the input
when file is selected. Note that if you define custom right section, clear button
will not be rendered.
Custom value component
Error state
Invalid name
Disabled state
Left and right sections
FileInput supports leftSection and rightSection props. These sections are rendered with absolute position inside the input wrapper. You can use them to display icons, input controls or any other elements.
You can use the following props to control sections styles and content:
rightSection/leftSection– React node to render on the corresponding side of inputrightSectionWidth/leftSectionWidth– controls width of the right section and padding on the corresponding side of the input. By default, it is controlled by componentsizeprop.rightSectionPointerEvents/leftSectionPointerEvents– controlspointer-eventsproperty of the section. If you want to render a non-interactive element, set it tononeto pass clicks through to the input.
Styles API
FileInput supports Styles API, you can add styles to any inner element of the component withclassNames prop. Follow Styles API documentation to learn more.
Description
Error
Component Styles API
Hover over selectors to highlight corresponding elements
Get element ref
Accessibility
If FileInput is used without label prop, it will not be announced properly by screen reader:
Set aria-label to make the input accessible. In this case label will not be visible, but screen reader will announce it:
If label prop is set, input will be accessible it is not required to set aria-label:
FileInputProps type
FileInputProps type is a generic interface which accepts a single type argument:
multiple value.