Skip to contentKino
Skip to Content

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.

npx shadcn add https://kinoui.com/r/file-input.json
Share on

Examples

Lisbon offsite

Expense report · 3–6 March · Approver Amara Okafor

Drop receipts here

or choose them from your computer

  • alfama-suites-invoice.pdf1.8 MBUploaded
  • tap-flight-lis-confirmation.pdf412 kBUploaded

PDF, PNG or JPG, up to 10 MB each.

Total €1,284.60

Default

Pick, drop or paste receipts, then send the report: the form submits the files with the rest of its fields.

Drop files here

or choose them from your computer

  • launch-film-cut-03.mp442 MBUploaded
  • pricing-page-copy-v4.pdf1.2 MBUploaded
2 files uploaded · 43 MB

The cut, its stills and anything the reviewer should read first. Images, videos, or PDF · Up to 50 MB each · 20 files at most

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.

Lisbon offsite

Expense report · 3–6 March · Approver Amara Okafor

Drop files here
  • alfama-suites-invoice.pdf1.8 MBUploaded
  • tap-flight-lis-confirmation.pdf412 kBUploaded

PDF, PNG or JPG, up to 10 MB each.

Total €1,284.60

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.

Drop the file here

or choose it from your computer

  • signed-travel-policy.pdf218 kBUploaded

One PDF, signed by you. A new file takes its place.

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.

Drop receipts here

or choose them from your computer

  • lx-factory-dinner.pdf
    x
    42%
  • rental-car-hertz.pdf
    x
    3 MB
  • IMG_20260305_ferry.jpgConnection lost

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.

Drop receipts here

or choose them from your computer

    PDF, PNG or JPG, up to 10 MB each.

    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.

    Drop files here

    or choose them from your computer

    • export-stuck-at-80.png240 kB
    1 file · 240 kB

    They go with your message. PNG or JPG · Up to 10 MB each · 5 files at most

    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

    New to Kino? Installation covers what your project needs first and the @kino namespace.

    API reference

    FileInput

    PropTypeDefaultDescription
    valueFile[]NoneThe files it holds.
    defaultValueFile[]SavedFile[][]The files it holds at first, and after its form is reset. A saved file, { value, name, size, type }, shows as uploaded and never uploads: an edit form’s.
    upload(file: File, options: { signal: AbortSignal; onProgress: (loaded: number) => void }) => Promise<string>NoneSends each file as it is added, calling onProgress with the bytes sent, and resolves with what the form sends for it, such as its id. It stops when signal aborts, and a thrown Error’s message shows on its row. A submit waits for the uploads, and one with a failed file fails the field’s check. Left out, the files themselves go with the form.
    concurrencynumber3How many files upload at once.
    onValueChange(value: File[], details: { added: File[]; removed: File[] }) => voidNoneCalled with the files after each change, and which came and went: with no upload, so you can start or cancel their uploads yourself.
    onReject(rejected: { file: File; reason: FileRejectionReason }[]) => voidNoneCalled with the files it didn’t add. The reason is type, size, count or duplicate.
    acceptstringNoneWhat it takes, as the native accept: MIME types (image/*) and extensions (.pdf), comma separated.
    maxSizenumberNoneThe largest file it takes, in bytes.
    maxFilesnumberNoneHow many files it holds at most.
    multiplebooleantrueWhether it holds more than one file. One that doesn’t swaps its file for the next.
    disabledbooleanfalseWhether files can be added or removed. A disabled Field disables it too.
    localestringNoneThe language sizes are written in; the browser’s when left out.

    FileInputDropzone

    PropTypeDefaultDescription
    childrenReactNode(state: FileDropState) => ReactNodeNoneIts content, or a function of the drag (dragging, over, verdict, count) to say what a drop will do.

    FileInputBox

    PropTypeDefaultDescription
    placeholderstring'Drop files here'What it says while no file is over it; “Drop a file here” for one file.

    FileInputTrigger

    PropTypeDefaultDescription
    namestringNoneThe name the files are submitted under.
    variant'default''outline''secondary''ghost''destructive''link''outline'The Button’s look.
    size'xs''sm''default''lg''default'The Button’s size.

    FileInputList

    PropTypeDefaultDescription
    children(file: File, index: number) => ReactNodeNoneA row for each file, usually a FileInputItem.

    FileInputItem

    PropTypeDefaultDescription
    progressnumbernullNoneHow far its upload has got, from 0 to 100; null while that isn’t known. Left out, it shows its own upload’s, or no track. At 100 it shows a tick.
    errorReactNodeNoneWhy its upload failed. Left out, it shows why its own upload did.
    childrenReactNodeNoneMore actions before the remove button.

    Data attributes

    AttributeOnDescription
    data-draggingFileInputDropzone, FileInputBoxPresent while a file is dragged anywhere on the page.
    data-overFileInputDropzone, FileInputBoxPresent while a file is over it.
    data-rejectFileInputDropzone, FileInputBoxPresent while what is over it is a type it doesn’t take.
    data-stateFileInputItemidle, uploading, complete or failed.

    CSS variables

    VariableSet it onDefaultDescription
    --file-input-riseFileInput or above0.5remHow far a new row rises into place.
    --swap-rollFileInput or above0.75emHow far a row’s status rolls as its upload starts, ends or fails.

    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.