Components / forms
FileDropZone
Takes files, by dropping them on it or by choosing them.
Summary
Takes files, by dropping them on it or by choosing them.
| APG pattern | none |
| Built on | native elements |
| Status | self-tested |
| Since | 0.16.0 |
<FileDropZone multiple accept=".pdf,text/csv" error={error} onFilesAdded={add} onFilesRefused={refuse}>
<EmptyState icon={<Icon name="upload-simple" />}>
<p data-se-text="body"><strong>Drop statements here</strong></p>
<p data-se-text="caption">PDF or CSV, from any account.</p>
<FileDropZone.Action>Choose files</FileDropZone.Action>
</EmptyState>
</FileDropZone>
Anatomy
A <div data-se="file-drop-zone"> holding the control, the body and, when a file was refused, the error. The control is the platform's file input, kept focusable and not drawn. The body holds one EmptyState, and the EmptyState's action is a <label> for the control, drawn as a Button: FileDropZone.Action. The zone adds the frame, the control and the drop, and restates none of the EmptyState's parts.
The title is a line in bold at the body size, not a heading. The zone is a control in a column, and a heading the size of a panel's title would be the second heavy thing in its group. The line under it is small.
| Part | Element | Required |
|---|---|---|
action | <label> | yes |
body | <div> | yes |
control | <input> | yes |
error | <p> | no |
icon | the caller's | the caller's |
label | <span> | yes |
spinner | the caller's | the caller's |
<div data-se="file-drop-zone">
<input data-part="control" type="file" id="statements" multiple accept=".pdf,text/csv" aria-describedby="statements-words">
<div data-part="body" id="statements-words">
<div data-se="empty">
<p data-se-text="body"><strong>Drop statements here</strong></p>
<p data-se-text="caption">PDF or CSV, from any account.</p>
<label data-part="action" data-se="button" data-se-text="ui" data-intent="accent" data-emphasis="solid" data-size="md" for="statements">
<span data-part="label">Choose files</span>
</label>
</div>
</div>
</div>
That markup works with no script: a press on the label opens the picker, and a form posts the files. The drop needs the binding.
Properties
| Property | Values | Default | What it does |
|---|---|---|---|
id | string | none | The file control's id. Generated when omitted; FileDropZone.Action is the label for it. |
multiple | boolean | none | Whether more than one file is taken at a time. With one, a second file is refused. |
accept | string | string[] | none | The types it takes: extensions, media types, or a family such as image/*, as a list or a comma-separated string. A file of another type is refused. Omitted, any file is taken. |
disabled | boolean | none | It takes no drop, and its action takes no press and no focus. |
error | React.ReactNode | none | Why the last drop or choice was refused, in words: which file and why. While it is set the zone is invalid, and the words are announced when they appear. |
onFilesAdded | (files: File[]) => void | none | Files were dropped or chosen and accepted. The zone keeps none of them. |
onFilesRefused | (refused: RefusedFile[]) => void | none | Files were dropped or chosen and not accepted, each with its reason. |
children | React.ReactNode | required | One EmptyState: the icon, the words, and a FileDropZone.Action as its action. |
FileDropZone.Action takes its words as children. It is drawn as the accent Button and has no variants: a zone has one action, and it is the way in.
States
| State | Expressed as | |
|---|---|---|
| Pressed | :active | |
| Disabled | :disabled | |
| Focused | :focus-visible | |
| Hover | :hover | |
| Disabled | data-disabled | |
| Invalid | data-invalid | |
| Over | data-over |
data-over is written by the binding while files are dragged over the zone. A drag has no pseudo-class.
Behavior
A press on the action opens the file picker. So do Enter and Space while the control holds focus: a file input is the platform's own button.
A drop adds files, exactly as choosing them does. Both go through one check and are reported the same way.
A refused file is refused in words. A file of a type that is not accepted, or a second file where one is taken, is not added. onFilesRefused carries each file with its reason, type or count; the caller writes the sentence and passes it as error. The rest of the files are still added.
It holds no files. It reports what arrived and keeps nothing. The caller shows the files and removes them, and the zone stays in place.
Only the zone takes a drop. A file dropped beside it goes where the page sends it. Something dragged that is not a file does nothing.
Disabled. It takes no drop, shows nothing while files are over it, and its action takes no press and no focus.
Accessibility
One focus stop, the file control. Its name is the action's words, and the EmptyState's words are its description. The frame has no role.
The ring is drawn on the action. The control holds focus and is not drawn, so its label shows the ring. The frame does not change.
Choosing reaches everything a drop does. Nothing can be done by dropping that cannot be done from the keyboard.
A refusal is announced. The error part is an alert, and the control is described by it and marked invalid.
Keyboard
| Key | Result |
|---|---|
| Tab | Moves focus to the file control |
| Enter | Opens the file picker |
| Space | Opens the file picker |
Roles, states and properties
| Attribute | Set by |
|---|---|
aria-describedby | set at render |
aria-invalid | set at render |
role | always alert |
Focus
The control takes focus; the action draws the ring. A disabled zone is skipped.
Screen reader
Not recorded as verified. Stage 4 of the readiness ladder — driving each component with VoiceOver and NVDA — is unstarted across the package, and no component should claim otherwise until docs/journal/ records the session that did it.
Contrast and target size
npm run check:contrast audits every color pair this component uses across all four skins, light and dark, and fails the build on a shortfall. Two waivers are on the record in docs/audit/DEFERRED.md.
It takes the touch floor under (pointer: coarse) — the visual size is unchanged on a desktop pointer.
Tested
test/apg/batch-a.test.jsxtest/apg/file-drop-zone.test.jsxtest/apg/menu-items.test.jsxtest/apg/partials-sweep.test.jsxtest/browser/file-drop-zone.spec.mjstest/browser/layers.spec.mjstest/browser/panel-regions.spec.mjstest/browser/upstream-natives.spec.mjs
Known gaps
_No upstream requirement is recorded as not applicable._
Appearance
A surface with a dashed edge in the control's edge color and the card's corner. No padding of its own: the EmptyState brings its own, a step less above and below than it has alone. The icon is in the accent color, the title in the text color and the line under it muted, with the icon, the words and the action one step apart. With files over it the edge takes the accent and the fill the highlight surface. After a refusal the edge takes the negative color and the reason is written under the words, inside the frame. Disabled, the icon and the words are muted, as an EmptyState is alone, and the action takes the disabled Button's colors.
| Token | Used for |
|---|---|
--se-accent | border-color, color, intent |
--se-bg | background, border-color |
--se-border | border-color |
--se-border-strong | border |
--se-border-width | border, border-width |
--se-control-h | block-size, inline-size |
--se-control-h-lg | block-size, inline-size |
--se-control-h-sm | block-size, inline-size |
--se-duration-fast | transition |
--se-duration-instant | transition |
--se-duration-slow | animation |
--se-ease-standard | transition |
--se-focus-color | outline |
--se-focus-offset | outline-offset |
--se-focus-width | outline |
--se-icon-md | block-size, inline-size |
--se-leading-body | line-height |
--se-mix-down | background, border-color |
--se-mix-hover | background, border-color |
--se-mix-line | border-color |
--se-mix-press | background |
--se-mix-shade | background, border-color |
--se-mix-soft | background |
--se-negative | border-color, color, intent |
--se-positive | intent |
--se-radius-button | border-radius |
--se-radius-card | border-radius |
--se-radius-pill | border-radius |
--se-scale-press | scale |
--se-space-3 | gap, padding-block-end, padding-inline |
--se-space-4 | padding-inline |
--se-space-5 | padding, padding-inline |
--se-space-6 | padding-block |
--se-surface | background |
--se-surface-highlight | background |
--se-surface-sunk | background |
--se-target-min | block-size, inline-size |
--se-text | color, intent |
--se-text-disabled | color |
--se-text-md | font-size |
--se-text-on-intent | color |
--se-text-sm | font-size |
--se-weight-semibold | font-weight |
Motion
The edge and the fill change color over --se-duration-fast. Nothing moves.
Content
The words say what to drop and what is taken. Drop statements here. PDF or CSV, from any account.
The action is a verb. Choose files, or Choose a file where one is taken.
A refusal names the file and the reason. notes.docx was not added. Statements are PDF or CSV.
Usage
Where files are the way in. An import, an upload, an attachment.
It stays when files arrive. Change its words to say more can be added; show the files beside it, in a Rows list or a table.
When not to use it. For one file inside a form with a label and an error, a Field holding a file input. For a container that is empty and takes no files, EmptyState.
Notes
The content is an EmptyState, the owner's word of 14 Nov 2026. The first draft of the spec gave the zone its own icon, title and hint. EmptyState already owns those, and one word means one part everywhere.
over joins the shared states. It has no opposite to name, so it is written as a mark of its own, data-over, as data-highlighted is, and not as a value of data-state.
The action is a label, not a button. A button would need script to open the picker. A label for the file input opens it natively, so the zone works on a page with none.
The control shares the rule for text that is read and not drawn. One declaration of that rule, with this selector beside sr, so the accessibility constant in it is still written once.
An error part was added to the spec. It said a refusal is told in words and named no place for them.
Inside a zone the EmptyState is an invitation. Alone it is all muted, because it says nothing is here. A zone says the opposite, so it sets three things on the EmptyState it holds: the icon takes the accent, the title the text color, and the pieces sit one step apart with a step less padding above and below. It writes none of the EmptyState's markup and names none of its parts but the icon and the action.