File input
Files picked, dropped or pasted, checked for their type, size and count, and listed with their upload progress. A form submits them like any other field.
Examples
Default
Pick, drop or paste receipts, then send the report: the form submits the files with the rest of its fields.
Upload as added
Given upload, each file goes up as it is added, the form sends the ids it gives back, and a submit waits for the uploads. The status under the rows carries the batch.
Box
In a form where a file is one answer among others, FileInputBox takes the drop in a box the height of a text field, with the button at its end.
One file
With multiple={false}, a new file takes the place of the one it holds: the old row fades as the new one rises.
Uploads
Give each row its progress, null while the size isn’t known, and an error when it fails. More actions, such as Retry, go in as children.
Rejected files
onReject gets each file that wasn’t added with its reason, type, size, count or duplicate, so you write what the person reads.
Sent with the form
With no upload, the files themselves go with the form when it is sent.
Installation
npx shadcn@latest add https://kinoui.com/r/file-input.json- Files
components/kino/spinner.tsxlib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxlib/notice.tsxlib/controllable.tscomponents/kino/button.tsxcomponents/kino/alert.tsxcomponents/kino/collapsible.tsxcomponents/kino/empty.tsxcomponents/kino/input.tsxlib/track.tscomponents/kino/progress.tsxlib/dates.tslib/announce.tsxlib/field-control.tsxlib/run-progress.tslib/highlight.tslib/flow.tslib/number-format.tslib/settle.tslib/uploads.tscomponents/kino/file-input.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
FileInput
FileInputDropzone
FileInputBox
FileInputTrigger
FileInputList
FileInputItem
Data attributes
CSS variables
Accessibility
- The trigger is the native file input, so it is reached with Tab and opened with Enter or Space, and the Field’s label names it.
- Dropping is a shortcut: everything a drop does can be done with the trigger, or by pasting files.
- Files added or removed, each upload that ends, the batch’s end and a submit waiting for uploads are announced in a status region, never each percent.
- The Field gets what the form sends: the files, or what their uploads gave back. A file that failed to upload fails the field’s check, so the form stops and says why.
- Each remove button is named after its file. After a removal, focus moves to the next row’s remove button, or the previous one, or the trigger.
- A failed upload shows its reason as text and a dashed edge in forced colours, never colour alone.