form-field — wyrd.component.file-upload

FileUpload

Dropzone and browse trigger for selecting files, reviewing selected file sizes, and removing files before submission.

Install @wyrd-company/react or the Flutter package and use it directly — your DESIGN.md does the styling.

01

Examples

Generated from the contract's examples block. Previews are the published @wyrd-company/react component, themed by the brand's role tokens — flip the site's light/dark toggle and they follow.

Code target Applies to every example on component pages.
idle state: idle
Usage
import { WyrdFileUpload } from "@wyrd-company/react";

<WyrdFileUpload selectedFiles={[]} accept="image/png,image/jpeg,image/webp" label="Upload design assets" />

// events: onBrowse, onFilesAdd, onFileRemove, onFilesClear, onFileReject
drag-over state: drag-over
Usage
import { WyrdFileUpload } from "@wyrd-company/react";

<WyrdFileUpload isDragOver selectedFiles={[]} label="Drop validation evidence" />

// events: onBrowse, onFilesAdd, onFileRemove, onFilesClear, onFileReject
disabled state: disabled
Usage
import { WyrdFileUpload } from "@wyrd-company/react";

<WyrdFileUpload isDisabled selectedFiles={[]} label="Upload release attachments" />

// events: onBrowse, onFilesAdd, onFileRemove, onFilesClear, onFileReject
02

Properties

NameTypeDefaultSummary
selected-files array Controlled selected file metadata, represented as name plus byte size.
max-size-bytes number 10485760 Maximum accepted size for one file, in bytes.
is-drag-over boolean false Controlled visual state for an active drag target.
is-disabled boolean false Prevents drop, browse activation, remove, and clear interactions.
accept string undefined File input accept attribute forwarded to the browse control.
03

Slots & events

SlotCardinalityAcceptsSummary
label zero-or-one text Optional visible label and accessible-name source for the upload control.
EventPayloadSummary
browse action Emitted when the browse trigger or keyboard activation requests the host file picker.
files-add files, action Emitted when files are dropped or accepted from a host picker.
file-remove name, action Emitted when one selected file is removed.
files-clear action Emitted when the selected-file list is cleared.
file-reject name, size-bytes, max-size-bytes, action Emitted when a candidate file is rejected by the max-size rule.
04

Tokens

The contract's token bindings. Open the shared contextual sidebar from any example; primary swatches reflect the color you pick there. Error swatches show the active preset's values; editing any knob switches to custom and resets error to TWW · Ink.

BindingToken
root.gap spacing.sm
label.color color.on-surface
label.font typography.label-md
dropzone.background color.surface
dropzone.background-active color.primary-hover
dropzone.foreground color.on-surface
dropzone.foreground-active color.on-primary
dropzone.border-color color.outline
dropzone.border-color-active color.primary
dropzone.border-width 1px
dropzone.radius rounded.md
dropzone.padding spacing.lg
dropzone.gap spacing.sm
browse-trigger.background color.primary
browse-trigger.foreground color.on-primary
browse-trigger.radius rounded.sm
browse-trigger.padding-x spacing.md
browse-trigger.padding-y spacing.sm
browse-trigger.font typography.label-md
file-item.background color.surface-container
file-item.foreground color.on-surface
file-item.radius rounded.sm
file-item.padding-x spacing.md
file-item.padding-y spacing.sm
file-item.gap spacing.sm
summary.color color.on-surface-variant
summary.font typography.body-md
error.color color.error
error.font typography.body-md
05

States

StateSourceSummary
idle behavior-runtime No drag is active and no selected files are present.
drag-over behavior-runtime A file drag is active over the dropzone.
has-files behavior-runtime At least one file is selected.
disabled property Disabled state derived from is-disabled.
rejected behavior-runtime The last add attempt rejected at least one file.
06

Accessibility

From the contract's accessibility obligations. Role group; Label slot or default label provides the accessible name for the file upload control.

  • Dropzone is focusable when enabled.
  • Enter and Space on the focused dropzone activate the browse request.
  • Remove triggers are reachable by Tab and expose the filename in their accessible label.
  • Disabled upload prevents browse, drop, remove, and clear activation.
  • Dropzone exposes disabled state when the upload is disabled.
  • Selected files are exposed as a list with one item per file.
  • Rejection text is exposed as an alert or status update.
  • Verified under: rtl, locale, reduced-motion, cvd-deuteranopia, density-compact, text-expansion, keyboard-inset.
07

SDUI

Status: partial. File metadata and control state serialize; host file handles, drag data transfer, and native picker activation remain target-local.

SerializableMembers
Propertiesselected-files, max-size-bytes, is-drag-over, is-disabled, accept
Slotslabel
Eventsbrowse, files-add, file-remove, files-clear, file-reject
The Wyrding Way — a contract-first design system. © Wyrd Company