FileUpload
Category: Forms & inputs
Anatomy
Section titled “Anatomy”+-------------------------------------------+| Label || +-------------------------------------+ || | | | ← dashed dropzone| | Click to upload or drag-and-drop | || | · .pdf, .docx · up to 10 MB | || | | || +-------------------------------------+ || optional description || || [ report-q3.pdf 2.4 MB × ] | ← file list| ▓▓▓▓▓▓▓▓░░░░░░░░░░ 63% |+-------------------------------------------+When to use
Section titled “When to use”- Any place users attach a file: avatar upload, attachment to a message, CSV import, document upload.
- Pair with
<AttachmentTile>if you want a post-upload view with rich previews.
Examples
Section titled “Examples”Single file, size-bounded
Section titled “Single file, size-bounded”<FileUpload label="Logo" accept="image/png,image/svg+xml" maxSize={2 * 1024 * 1024} onFiles={([file]) => upload(file)}/>Multiple files with progress
Section titled “Multiple files with progress”const [progress, setProgress] = useState<Record<string, number>>({});
<FileUpload multiple accept=".pdf,.docx" onFiles={(files) => files.forEach((f) => uploadWithProgress(f, (pct) => { setProgress((p) => ({ ...p, [f.name]: pct })); }), ) } progress={progress}/>;Wired to react-hook-form
Section titled “Wired to react-hook-form”const { setValue, watch } = useFormContext<{ files: File[] }>();
<FileUpload label="Attachments" multiple onFiles={(files) => setValue('files', [...(watch('files') ?? []), ...files])}/>;Tokens
Section titled “Tokens”See the tokens block in this spec’s frontmatter.
Install: @helix-ui/core
import { FileUpload } from '@helix-ui/core';status: stable · since: 0.1.0
Tags: file, upload, dropzone, attachment, drag-drop, input
| Name | Type | Default | Description |
|---|---|---|---|
label |
string |
undefined |
Field label rendered above the dropzone. |
description |
ReactNode |
undefined |
Helper text rendered below the dropzone. |
hint |
ReactNode |
undefined |
Visible inside the dropzone — defaults to a “Click to upload or drag and drop” cue. |
accept |
string |
undefined |
MIME / extension filter; e.g. “image/*” or “.pdf,.docx”. |
maxSize |
number |
undefined |
Max file size in bytes. Files larger are reported via onReject. |
multiple |
boolean |
false |
Allow selecting more than one file. |
onFiles |
(files: File[]) => void |
undefined |
Fires with accepted files after the accept + size filters. With multiple=false, emits only the first accepted file, matching the displayed selection. A rejected-only batch preserves the current selection. |
onReject |
(rejections: { file: File; reason: 'size' | 'type' }[]) => void |
undefined |
Fires for files that fail filtering. |
progress |
Record<string, number> |
undefined |
Map of file.name → 0-100 percent. helix-ui renders a progress bar per file. |
errors |
Record<string, string> |
undefined |
Optional per-file error messages, keyed by file.name. |
tone |
'brand' | 'neutral' |
brand |
Tone for the active drop ring. |
disabled |
boolean |
false |
Disable interaction. |
Tokens used
Section titled “Tokens used”color.bg.surface.default, color.bg.surface.subtle, color.bg.action.brand.subtle, color.bg.action.brand.default, color.border.default, color.border.focus, color.text.primary, color.text.secondary, color.text.muted, color.text.action.brand, color.text.action.danger, radius.sm, radius.md, radius.lg, space.1, space.2, space.3, space.5, font.size.xs, font.size.sm, font.weight.medium, font.weight.semibold
Accessibility
Section titled “Accessibility”Role: button
Keyboard
| Key | Action |
|---|---|
Tab |
Focus the dropzone. |
Enter |
Open the native file picker. |
Space |
Open the native file picker. |
Notes
- The dropzone is a labeled button (
role="button") for screen readers. - Drag-and-drop is a supplementary affordance; keyboard + native picker is the primary path.
- Each progress bar exposes ARIA progress state with min/max/value.
- Disabled state removes the dropzone from the tab order.