Component libraryFile upload
File upload
ProChoose or drop files, inspect limits and remove selections.
npx shadcn@latest add @tidal-pro/file-uploadInstallation
Pro source is gated. Configure the @tidal-pro registry using the agent guide. Create an access key from your account after purchasing.
Terminal
Import components/ui/tidal.css, components/ui/file-upload.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
Controlled files (readonly File[]) and onFilesChange required; visible label required. Optional description/error/disabled, accept(extension or MIME list), maxFiles(default5) and maxSize(default10million decimalbytes). Finite counts floor to at least1; invalid bounds/accept syntax show a configuration error and disable choosing. Zero maxSize permits empty files. Native picker and file-only drag/drop share ordered validation; multiple selections append to current files, maxFiles1 replaces the selection with the first valid incoming file. Invalid incoming files are rejected without discarding an existing single file; different File objects are never deduplicated by filename. onReject receives file/code/message records; validateFileSelection and formatFileSize are exported for integration. Metadata/type checks are local UX validation; consumers own actual uploads and final validation. Root forwards native div/ref/attributes/drag callbacks; preventing the caller onDrop stops automatic selection. inputRef exposes the unnamed native picker, including React19 callback-ref cleanup. Native picker resets after selection for same-file reselection; controlled files remain the source of truth. Native FormData does not include this unnamed/reset picker: append your controlled File objects and implement any required-field validation in the consumer. No file body is read, uploaded or persisted by the component. Native choose/remove controls44px; removal focuses Choose before proposing the next array, and consumers own aborting any active request. Optional fileStates ReadonlyMap<File,{state:uploading|complete|error,progress?,label?}> drives real consumer-owned progress/status. Finite percentages clamp0..100; unknown progress omits aria-valuenow, complete resolves100. Override labels for local simulations. A single polite status describes actual selected files and state counts, never each percentage; linked validation feedback and full filenames remain readable. Native disabled controls, internally scrollable file lists, long-name wrapping, scoped light/dark CSS and reduced motion supported. No automatic upload, network request, storage or timer is introduced. Decorated folder entry and drag pose, row entrance and controlled rails reflect real interaction.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.