Handoff: Dropzone
Rewritten 2026-11-20 against v2.0.0-beta.21 to the lessons template. Nothing in this file was checked by eye in a session; where a result is quoted from an earlier note it says so.
What and why
A compact area to add files by dragging them in or by browsing, from the designer's reference: a dashed rounded outline holding an upload icon and one line of text, "Drop an image or brief, or browse". PDS has the File Upload, a form field with a "Choose file" button and no drag and drop, so this is a new component, not an extension of it. The Chat Panel and Composer proposals accept drops but have no visible area to drop on.
- Figma / Jira: Figma page under Preview; Jira none. Source: the designer's reference image (2026-10-21).
- Context:
context.md
Exploration and decisions
- New component, not a File Upload variant: different anatomy and purpose (a form field with a validation message and a chosen file name, versus a compact drop area). See "Extension or new component".
- The sentence is two props,
labelandbrowseLabel, both required, so each half can be translated and browse is a realbutton. - Behavior: a drop or the file dialog calls
onFilesDrop(files); the files are filtered byaccept(extensions, types andtype/*wildcards, as on a file input) and cut to one unlessmultiple. While a file is over the zone the outline turns solid with the interactive focus color and the selected background. The hidden file input is reset after each change so the same file can be chosen again. The zone shows no files: the screen owns the list. - Drag counting:
dragenteranddragleavefire for each child the pointer crosses, so they are counted (as in the Chat Panel). - Keyboard: dropping is a pointer shortcut; keyboard and screen reader users press browse. The zone itself is not focusable.
Full list: decisions.md.
API
From Dropzone.tsx. DropzoneProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onDrop'>.
| Prop | Type | Default | Purpose |
|---|---|---|---|
accept |
string |
none | Which files to accept, as on a file input (image/*,.pdf). Applies to the dialog and filters dropped files. |
browseLabel |
string |
required | Text of the browse button, the end of the sentence ("browse"). Provide it translated. |
className |
string |
none | Additional class names. |
disabled |
boolean |
false |
Drops and the browse button do nothing; the zone is faded. |
label |
string |
required | The text before the browse button ("Drop an image or brief, or"). Provide it translated. |
multiple |
boolean |
false |
Can more than one file be added at once? When false, only the first accepted file is delivered. |
onFilesDrop |
(files: File[]) => void |
none | Called with the files from a drop or from the dialog (filtered by accept). Not called when nothing is accepted. The screen owns the list. |
Variants and states: default, drag over (a solid, highlighted outline), disabled; the browse button has hover, active, focus and disabled. Stories: Default, Disabled, Interactive. There is no static story for drag over; it is only reachable by dragging a file in Interactive.
Tokens used
From dropzone.css as it is now:
--pds-animation-transition-input--pds-border-radius-default,--pds-border-radius-input--pds-border-width-default,--pds-border-width-outline--pds-color-border-default--pds-color-foreground-default-secondary--pds-color-interactive-background-selected,--pds-color-interactive-focus--pds-color-interactive-link-active,--pds-color-interactive-link-default,--pds-color-interactive-link-hover--pds-spacing-2xs,--pds-spacing-5xs,--pds-spacing-s,--pds-spacing-xs--pds-typography-ff-default,--pds-typography-fw-semibold,--pds-typography-size-s
One raw value: opacity: 40% on the disabled state (dropzone.css:56). There is no opacity token in the package, and it is not listed in custom.md. See "Expect to change".
Impact
From impact.md: no existing PDS component is reached and no --pds-* token is redefined. No other proposal depends on it.
Reused vs net-new
- Reused: the PDS
Icon(upload, sizes; the proposal imports it through the localIconwrapper), thevisually-hiddenclass, thepds-copy-sclass. - Net-new:
.pds-dropzonewith--drag-over,--disabled,__browse,__iconand__label; all props. Seecustom.md(no custom variables).
Accessibility
Not tested with a screen reader or in a browser; the points below come from reading the code.
- Browse is a real
buttonthat opens the file dialog, with a visible focus ring (outline, 2px, offset 2px). Its accessible name is onlybrowseLabel("browse"), not the whole sentence, so out of context it reads as "browse". See "Expect to change". - The file input is visually hidden with
tabIndex={-1}. It has anidbut no label and noaria-hidden, so a screen reader virtual cursor may still reach an unnamed file control (inference, not tested). - Dropping is a pointer-only shortcut. The zone has no role; the text and the button are what is announced.
- Not handled: announcing that files were added (the screen owns the list and should announce it, for example with a live region) and a drag-over announcement. Rejected files are not announced either: they are dropped silently.
- Contrast: secondary text and link color on the surface, plus the drag-over background; all tokens from the package. The Storybook a11y panel has not been run, and neither theme was checked by eye (not checked).
Decisions and open questions
Each has a recommended answer (the designer decides).
- A validation or error state (a rejected type or size)? Recommendation: not in the component. The screen owns validation and the message, as it owns the file list. This also fixes the silent drop (see "Expect to change", item 2).
- A size or file-count limit? Recommendation: no; same reason, the screen validates.
- A taller, multi-line version for pages where the dropzone is the main content? Recommendation: not now; add it when a page needs it, as a separate decision (for example a size flag), not a prop of this first version.
- Should the drag-over highlight reuse the Chat Panel's drop overlay look? Recommendation: no. The Chat Panel overlay covers a whole panel, this zone is the target itself; keep the solid outline and selected background.
Extension or new component
New component, not an extension of FileUpload (inputs/FileUpload). At beta.21 FileUpload is a form field (label, message, validation, a "Choose file" button and the chosen file name) with no drag and drop; extending it would mean hiding most of its parts. No other component in .pds-reference/src handles dropped files (grep for dropzone, onDrop and drag finds nothing). Nothing in an existing component changes, so no human behavior or stories are touched. It does share accept, multiple and disabled with FileUpload (same names and meanings), but not the callback (see "Expect to change"). Recommendation: place it next to FileUpload in src/components/inputs/.
Footprint
- Nothing is drawn outside the box: no shadow, no pseudo-element, no absolutely positioned part. The drag-over state changes the border from dashed to solid and the border color and background, but not the border width, so it does not shift layout.
- The browse button's focus ring is drawn 2px outside the button, inside the zone's padding (10px block, 12px inline), so the zone itself does not clip it. Not checked by eye.
- A parent with
overflow: hiddencannot cut anything of ours. The zone is a flex row that fills its parent's width and centers its content; it does not wrap, so a long translatedlabelsqueezes or overflows on a narrow parent. Not checked at 375px. - The visually hidden file input is inside the zone; depending on the
visually-hiddenutility's positioning it could affect scroll in a positioned parent. Not checked. - Only the zone itself is a drop target. A file dropped just outside it is handled by the browser (it may open the file); the screen decides whether to add a page-level handler.
Dark mode and per-size values
Single size (no size prop). There is no per-theme CSS override; every color is a --pds-* token that changes with the theme. Values below are what the tokens resolve to in variables.light.css and variables.dark.css; none was seen on screen.
| Value | Default | Drag over | Disabled | Dark mode |
|---|---|---|---|---|
| Border | 1px dashed border-default, radius 6px (radius-input) |
1px solid interactive-focus |
same, with 40% opacity | border-default and interactive-focus change by theme |
| Background | transparent | interactive-background-selected |
transparent | token changes by theme |
| Text color | foreground-default-secondary |
same | same, 40% opacity | token changes by theme |
| Browse color | interactive-link-default, semibold |
same | inherited color and weight | link tokens change by theme |
| Browse hover / active | interactive-link-hover + underline / interactive-link-active |
same | none (:enabled only) |
link tokens change by theme |
| Icon | upload, size s (14px) |
same | same | inherits text color |
| Padding / gap | 10px block, 12px inline / gap 8px | same | same | same |
| Text | pds-copy-s (14px), browse at size-s |
same | same | same |
Expect to change
Each is a choice that may not match toolkit conventions, with a recommended answer.
- Callback name and type (L1, L2).
onFilesDrop(files: File[])is named for the drop, but it also fires for the dialog.FileUploadusesonFileChange(files: FileList). Recommendation: rename toonFileChange. Keep theFile[]argument because a filtered or cut list cannot be aFileList; the engineer may prefer to matchFileListand drop the filtering (item 2). - Rejected files are dropped silently (
Dropzone.tsx:120-124).deliverfilters byacceptand, whenmultipleis false, keeps only the first file; the screen is never told. Recommendation: do not filter or cut in the component. The native input already filters the dialog throughaccept; pass every dropped file to the callback and let the screen validate and show the message. That also removesmatchesAccept. The alternative is an optionalonFilesRejectcallback. - Two required strings that split one sentence (L2, L10).
labelandbrowseLabelare required so the sentence is translatable and the button is a real element, but a language where "browse" is not at the end cannot reorder them. Recommendation: keep both required (an English default would be hardcoded content) and add a[Dropzone]dev warning when either is empty, as Button does. - The button's accessible name is just "browse". Recommendation: link the sentence to the button, for example
aria-describedbyon the button pointing at the label span, or ask translators for a self-explanatorybrowseLabel("browse files"). The designer's wording stays. - Hidden file input is not hidden from assistive technology. Recommendation: add
aria-hidden='true'to the input; the browse button is the accessible control. ...propsis spread last, after the drag handlers (Dropzone.tsx:149-153). A consumer'sonDragEnter,onDragOver,onDragLeavereplace the internal ones and break the drag-over state. Recommendation: call the consumer's handler inside the internal one, or take those props out of the spread.- Disabled opacity is a raw
40%and does not match the toolkit. The PDS inputs useopacity: 63%for disabled (inputs/input-utilities.css). Recommendation: use 63% to match the inputs, and list the value incustom.md. matchesAcceptis a local helper (L9). Optional: it goes away under item 2.- Story-only parts (L9). In the
Interactivestory thedivwith an inlinestylegrid and theulof file names are a stand-in for the screen's list; do not port them. Theargs(acceptofimage/*,.pdf,multiple: true) are example values, not defaults. - Position props, unions, nested screen-reader text: none.
disabledandmultipledefault off and matchFileUpload(L2).
Target-version check
Checked 2026-11-20 against .pds-reference/src at v2.0.0-beta.21 and its CHANGELOG.mdx.
| Item | Already in beta.21? |
|---|---|
Dropzone component, .pds-dropzone* classes |
No (grep of src and the changelog finds nothing). |
Drag and drop on FileUpload |
No. FileUpload has accept, multiple, disabled, onFileChange(files: FileList) only. |
Icon upload (also cloudArrowUp) |
Yes, in icons/Icon/icon-registry.ts. |
pds-copy-s, visually-hidden |
Yes. |
| Tokens listed above | Yes, in the package token files. |
| Disabled opacity token | No token exists; input-utilities.css uses a literal 63%. |
mergeClasses |
Yes, @libs/components/utils (the proposal uses a local stand-in). |
Port notes
- New component (
npm run generate:component), next toFileUploadinsrc/components/inputs/. Swap the localIconwrapper for@components/icons/Icon/Iconand the localmergeClassesfor@libs/components/utils. useId,useRefanduseStateare named React imports already.- The story tag
new-patternbecomesv2-newin the toolkit. Add a static drag-over story (a forced--drag-overclass) so the state can be reviewed without dragging.
Preview
npm run storybook, then Component Proposals/Dropzone. Figma: https://www.figma.com/design/AMGWJbraJoi2PKWnxo29Ah/PDS-Proposals?node-id=482-43