Skip to content

File input

Preview Available in release assets

Present a native file picker in a resilient shell with space for concise selection and drag-state guidance.

File input primary example

Show code
<div class="thin-field">
  <label for="attachments">Attachments</label>
  <div class="thin-file-input">
    <input id="attachments" name="attachments" type="file" multiple aria-describedby="attachments-hint">
    <span class="thin-file-guidance" id="attachments-hint">Choose files. Drag and drop is available only when the application adds and announces an uploader enhancement.</span>
  </div>
</div>

Each authored example uses the production assets and includes copyable markup.

Anatomy

  • Associated label
  • Native input[type=file]
  • Optional guidance

Variants and sizes

  • Single file — shown above
  • Multiple files — shown above
  • Accepted file types — shown above

Rendered fixtures exercise authored content and constrained layouts with the same production assets.

  • Empty — shown above
  • Files selected, including long filenames — shown above
  • Focused — shown above
  • Disabled — shown above
  • Application-authored drag state — shown above

Interaction and keyboard behavior

File selection, keyboard activation, filename display, form encoding, validation, and submission remain native. Thin-Sky does not turn this component into a drop target.

Accessibility

Associate the label and guidance. If an application adds drop behavior, keep the input operable and announce accepted files, errors, and drag-state changes in text.

Contract
NATIVE
Basis
Native <input type="range"> and <input type="file">; no APG widget
Evidence
  • tests/unit/library/form-inputs.test.ts

API

Wrap a native file input in .thin-file-input. Applications may set data-dragging only while a separately implemented drop target is active; it is a presentation hook, not uploader behavior.

Behavior tier: native

Structured host, property, and example tables are not authored for this item yet. Use the summary above and the primary example.

Fallback

The native file picker remains keyboard accessible and submits selected files without CSS or JavaScript.

Assets and dependencies

  • /components.css

Dependencies: None

Source: packages/ui/src/items/file-input/style.ts

Composition

Derived from the examples and style specs, not authored.

Composes

Used by