Rime

FileDrop

A drop zone and file picker with type and size checks and per-file status chips.

FileDrop validates type and size client-side, lists files as FileChips with uploading, done and error states, and keeps a real file input for keyboard users.

Installation

npx shadcn@latest add KezLahd/rime/file-drop

Also installs: base, button, field, icon, spinner.

Usage

import { FileDrop } from "@/components/ui";

<FileDrop files={files} onFilesChange={setFiles} accept={[".pdf"]} multiple={false} />

Examples

Default

Drop the file here

PDF, JPG or PNG, up to 10 MB.

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

FileDrop

FileDrop props
PropTypeDefaultDescription
filesRequiredFile[]
onFilesChangeRequired(files: File[]) => void
acceptstring[][".pdf", ".jpg", ".jpeg", ".png"]Extensions including the dot. Checked by name and MIME type both.
maxSizeBytesnumber10 * 1024 * 1024
multiplebooleantrue
disabledboolean
invalidboolean
titleReactNode"Drop the file here"
descriptionReactNodeDefaults to a sentence built from accept and maxSizeBytes.
statusFor(file: File) => Pick<FileChipProps, "status" | "message"> | undefinedPer-file upload state, keyed by file name.
idstring
classNamestring
forceDragOverbooleanfalseHolds the drag-over state without a drag. For the styleguide only.

FileChip

FileChip props
PropTypeDefaultDescription
nameRequiredstring
sizeRequirednumber
status"ready" | "uploading" | "done" | "error""ready"ready = attached, not yet sent.
messageReactNodeShown under the name; required when status is "error".
onRemove() => void
classNamestring

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

This component has no tokens of its own; it reads the system tokens below.

System tokens it reads

FileDrop system tokens
TokenDefaultLive value
--brandtokens.css…
--brand-deeptokens.css…
--brand-filltokens.css…
--brand-gradienttokens.css…
--brand-gradient-softtokens.css…
--danger-field-filltokens.css…
--danger-filltokens.css…
--danger-inktokens.css…
--danger-linetokens.css…
--durtokens.css…
--easetokens.css…
--focus-ringtokens.css…
--font-monotokens.css…
--glow-smtokens.css…
--ink-bodytokens.css…
--ink-brandtokens.css…
--ink-disabledtokens.css…
--ink-headingtokens.css…
--ink-inversetokens.css…
--ink-mutedtokens.css…
--line-brandtokens.css…
--line-softtokens.css…
--r-lgtokens.css…
--r-mdtokens.css…
--r-xstokens.css…
--rgb-brandtokens.css…
--rgb-brand-deeptokens.css…
--rgb-contacttokens.css…
--rgb-dangertokens.css…
--rgb-whitetokens.css…
--success-filltokens.css…
--success-inktokens.css…
--surface-solidtokens.css…
--surface-sunkentokens.css…
--text-bodytokens.css…
--text-captiontokens.css…
--text-smalltokens.css…

Accessibility

  • The "Choose files" button opens the native picker; drag and drop is an enhancement, never the only way.

Do and don't

Do

  • State the accepted types and size limit in description.

Don't

  • Don't trust the client check; validate on the server too.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open file-drop.md