File Input
Lets people choose or drop a file to upload.
- Status
- ReadyBuild day 10 of 21
- Code
- In React
- Role
- Form
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Drag files here
PNG, JPG, max 5 MB
Pastes as editable layers. Shadows are not exported.
import { FileInput } from "@/ui";
export default function FileInputDemo() {
function handleFiles(files: File[]): void {
console.log(files.map((f) => f.name));
}
return <FileInput description="PNG, JPG, max 5 MB" accept="image/png,image/jpeg" onFiles={handleFiles} />;
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Drag files here
PNG, JPG, max 5 MB
Drag files here
PNG, JPG, max 5 MB
Drag files here
PNG, JPG, max 5 MB
Drag files here
File exceeds 5 MB
Drag files here
PNG, JPG, max 5 MB
PNG, JPG, max 5 MB
PNG, JPG, max 5 MB
PNG, JPG, max 5 MB
File exceeds 5 MB
PNG, JPG, max 5 MB
File exceeds 5 MB
Pastes as editable layers. Shadows are not exported.
Props
- type
- "dropzone" | "button" | "inline" · default "dropzone"
- The layout.
- title
- string · default "Drag files here"
- The dropzone title.
- description
- string · default none
- The rules shown to the user.
- buttonLabel
- string · default "Choose file"
- placeholder
- string · default "No file selected"
- Inline only.
- accept, multiple
- string, boolean · default none
- Native file input attributes.
- progress
- number · default none
- 0 to 100 while uploading. The upload itself is yours.
- error
- string · default none
- Replaces the description and marks the field.
- disabled
- boolean · default none
- dragging
- boolean · default none
- Forces the dragging look, for documentation.
- onFiles
- (files: File[]) => void · default none
- Called with the chosen or dropped files.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- type
- dropzone, button, or inline.
- 🎯 State
- error, disabled, progress, dragging
- Hover is the browser. Dragging is a real drag or the prop. Uploading is progress.
- Title, Description, Button Value, Placeholder
- title, description, buttonLabel, placeholder
- Same text.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Choosing works from the keyboard: Tab to the button and press Enter or Space. Dropping is an extra for pointer users.
Screen readers
- The button is a real button. The error or description is linked with aria-describedby. Upload progress is a progressbar.
What you still need to do
- Check the type and size in your code too. accept is only a hint for the file picker.
- Show uploaded files with the Document component, below the dropzone.
When to use
Documents such as ID cards, receipts, and attachments.
Do and don't
Do
- State the allowed file types and the size limit before upload.
- Show upload progress and a way to remove the file.
Don't
- Accept a file and reject it only after upload.
- Rely on drag and drop alone: keep a button.
Related
4 of 28 other molecules, same role and ready ones first.
- Amount InputAn input for money that formats the value as the user types.Ready
- ComboboxAn input that suggests matching options as the user types.Ready
- Date PickerChooses a date from a calendar or by typing.Ready
- InputA field for entering short text, numbers, or other data.Ready
Status reflects the component tracker snapshot of 29 October 2026.