Components / forms

FileDropZone

Takes files, by dropping them on it or by choosing them.

Rendered from the package · open on its own

Summary

Takes files, by dropping them on it or by choosing them.

APG patternnone
Built onnative elements
Statusself-tested
Since0.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.

PartElementRequired
action<label>yes
body<div>yes
control<input>yes
error<p>no
iconthe caller'sthe caller's
label<span>yes
spinnerthe caller'sthe 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

PropertyValuesDefaultWhat it does
idstringnoneThe file control's id. Generated when omitted; FileDropZone.Action is the label for it.
multiplebooleannoneWhether more than one file is taken at a time. With one, a second file is refused.
acceptstring | string[]noneThe 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.
disabledbooleannoneIt takes no drop, and its action takes no press and no focus.
errorReact.ReactNodenoneWhy 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[]) => voidnoneFiles were dropped or chosen and accepted. The zone keeps none of them.
onFilesRefused(refused: RefusedFile[]) => voidnoneFiles were dropped or chosen and not accepted, each with its reason.
childrenReact.ReactNoderequiredOne 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

StateExpressed as
Pressed:active
Disabled:disabled
Focused:focus-visible
Hover:hover
Disableddata-disabled
Invaliddata-invalid
Overdata-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

KeyResult
TabMoves focus to the file control
EnterOpens the file picker
SpaceOpens the file picker

Roles, states and properties

AttributeSet by
aria-describedbyset at render
aria-invalidset at render
rolealways 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.jsx
  • test/apg/file-drop-zone.test.jsx
  • test/apg/menu-items.test.jsx
  • test/apg/partials-sweep.test.jsx
  • test/browser/file-drop-zone.spec.mjs
  • test/browser/layers.spec.mjs
  • test/browser/panel-regions.spec.mjs
  • test/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.

TokenUsed for
--se-accentborder-color, color, intent
--se-bgbackground, border-color
--se-borderborder-color
--se-border-strongborder
--se-border-widthborder, border-width
--se-control-hblock-size, inline-size
--se-control-h-lgblock-size, inline-size
--se-control-h-smblock-size, inline-size
--se-duration-fasttransition
--se-duration-instanttransition
--se-duration-slowanimation
--se-ease-standardtransition
--se-focus-coloroutline
--se-focus-offsetoutline-offset
--se-focus-widthoutline
--se-icon-mdblock-size, inline-size
--se-leading-bodyline-height
--se-mix-downbackground, border-color
--se-mix-hoverbackground, border-color
--se-mix-lineborder-color
--se-mix-pressbackground
--se-mix-shadebackground, border-color
--se-mix-softbackground
--se-negativeborder-color, color, intent
--se-positiveintent
--se-radius-buttonborder-radius
--se-radius-cardborder-radius
--se-radius-pillborder-radius
--se-scale-pressscale
--se-space-3gap, padding-block-end, padding-inline
--se-space-4padding-inline
--se-space-5padding, padding-inline
--se-space-6padding-block
--se-surfacebackground
--se-surface-highlightbackground
--se-surface-sunkbackground
--se-target-minblock-size, inline-size
--se-textcolor, intent
--se-text-disabledcolor
--se-text-mdfont-size
--se-text-on-intentcolor
--se-text-smfont-size
--se-weight-semiboldfont-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.