Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Dropzone

  • Needs review
  • WCAG 2.2 evidence
  • RTL

An area to drop files on, with a Browse button that opens the file picker. Built on React Aria DropZone and FileTrigger. Dragging is an enhancement: Browse is a real button reached with Tab and activated with Enter or Space (WCAG 2.1.1, 2.5.7), and pasting files works while the drop target has keyboard focus. The drop target is named by the title and the helper; drag-over, the helper and errors are announced through polite live regions (4.1.3). Errors show an icon and text, not colour alone (1.4.1, 3.3.1). Upload logic stays in your app: onSelect receives File objects; show progress with FileItem. Consumer duties: title and helper wording (accepted types and size), error wording, size checks, and announcing what happens to the files (FileItem announces completion and errors).

import { Dropzone } from "@nexera-ui/react";
Loading example…
5
examples
17
props
7
live controls
1
platform
12
WCAG criteria
2
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
title
description
errorMessage
isInvalid
layout
allowsMultiple
isDisabled
Generated code
import { Dropzone } from "@nexera-ui/react";

<Dropzone />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

Compact

Figma Layout=Compact: one row for tight spaces; the Browse button wraps under the text in narrow containers.

Loading example…

States

Semantic states: isInvalid with errorMessage and isDisabled.

Loading example…

With file list

A realistic composition: accepted files are listed as FileItems (here they "upload" at once), a rejected type turns the zone to the Error state with an announced message.

Loading example…

Long text and right to left

Long titles and helpers wrap; right-to-left layouts mirror the compact row.

Loading example…

Props 17

Press "Try it" on a card to load that prop into the playground.

17 props shown

title*Nexera
ReactNode

Visible title, for example "Drag files here or browse". It names the drop target. The Figma sample is example content.

Default –
descriptionNexera
ReactNode

Helper text, saying which files are accepted before an error happens ("PDF, JPG or PNG up to 10 MB"). It is read with the drop target and the Browse button.

Default –
errorMessageNexera
ReactNode

Error text that replaces the helper while isInvalid, with the alert icon in the tile. Announced politely; say what is wrong and how to fix it (WCAG 3.3.1, 3.3.3, 4.1.3).

Default –
isInvalidNexera
boolean

Error state: danger stroke, alert icon and errorMessage. Set it from your own checks (type, size, count), for example in onReject.

Default false
layoutNexera
"default" | "compact"

Arrangement: a centred column, or a single row for tight spaces.

Default default
acceptedFileTypesNexera
readonly string[]

Accepted file types as MIME types, wildcards or extensions (["application/pdf", "image/*", ".png"]). Filters the file picker and sorts dropped or pasted files into onSelect and onReject. Say the same in description.

Default –
allowsMultipleNexera
boolean

Allow several files at once (picker, drop and paste). With false, only the first accepted file is selected; the rest go to onReject.

Default false
onSelectNexera
(files: File[]) => void

Called with the accepted files from the Browse picker, a drop or a paste. Upload them yourself.

Default –
onRejectNexera
(files: File[]) => void

Called with the files that did not match acceptedFileTypes (or extra files when allowsMultiple is false).

Default –
browseLabelNexera
string

Text of the Browse button: the non-drag way to pick files (WCAG 2.5.7). Translate it.

Default Browse files
dropTitleNexera
string

Title while files are dragged over the zone, also announced politely. Translate it.

Default Drop to upload
classNameNexera
string

Extra classes for the root, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style of the root.

Default –
isDisabledReact Aria
boolean

Whether the drop target is disabled. If true, the drop target will not accept any drops.

Default false
aria-labelReact Aria
string

Defines a string value that labels the current element.

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

10 direct · 2 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 2.5.7Dragging MovementsLevel AA · tested directly
  • 3.3.1Error IdentificationLevel A · tested directly
  • 3.3.7Redundant EntryLevel A · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-drop-target
  • data-hovered
  • data-invalid
Usage
<Dropzone className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components