File picker

ds-file-picker keeps a native input type="file" in light DOM. It is the focusable hit target: the browser owns the file chooser, labels, keyboard activation, file drops, required validation, form values, reset and disabled fieldsets. DS1 composes the visible Button face, focus ring and scale.

<ds-file-picker label="Choose logo" secondary>
<input type="file" name="logo" accept="image/svg+xml,.svg" aria-label="Choose logo">
</ds-file-picker>

The normal picker is one square high and as wide as its label. icon makes it a one-square icon control; preview makes a four-square image control, or two squares with compact. area fills its container as an eight-square-high upload target, or four squares with compact. It uses the shared secondary face and wraps its label. Use it for a larger native drop target rather than drawing a product-owned well. Put decorative content in the content slot. Keep an accessible name on the native input. The composed button is inert and hidden from assistive technology so there is one control and one tab stop.

React products import FilePicker from DS1/react/file-picker, registering the Lit element in the browser before hydration. The required label supplies the visible copy and native accessible name. children supplies decorative content. The forwarded ref, native attributes and event handlers belong to the input; className and style belong to the host for placement.

<FilePicker label="Attach files" multiple accept="image/*,.pdf"
disabled={pending} onChange={event => acceptFiles(event.currentTarget.files)} />

Products own accepted types, size limits, selected-file display, upload requests, permissions and persistence. No file leaves the browser through this component. Clear event.currentTarget.value after consuming a selection when choosing the same file again should be possible. Do not hide the input or add a second click trigger. Native accept guides selection; product validation still applies. When a containing product surface also accepts dropped files, it owns that drop: prevent the native default and pass a copied array to the same guarded upload function. This avoids uploading once on drop and again on change. Set dragging when that outer surface has a file over it: DS1 applies the same drag feedback to the picker, suppressed when the native control is disabled. Verify file selection and keyboard activation, disabled fieldsets, reset, focus, pending recovery and light/dark scaled layouts without uploading live test data.

In React, onCancel receives the native chooser cancellation event. Keep a menu that contains the picker mounted until onChange or onCancel, so returning from the system chooser cannot lose the selected files. Use role="menuitem" inside a Select or Context menu to share its row and arrow navigation while Enter and Space stay native; a file row never closes the menu before the chooser answers.

Choose a print file

The file input stays native. Selection is local to this preview; nothing is uploaded.