Skip to content

File Input ​

The catnip-input-file component provides a drag-and-drop upload field with an optional file list below the drop zone.

Overview ​

Use the file input when users need to select one or more files from their device or drop files into the page. The drop zone supports horizontal and vertical orientations, inline danger feedback, and all standard field affordances (label, supporting text, disabled state).

Compose uploaded files with catnip-file-item in the files slot — one row per file for progress, errors, and actions.

Orientations ​

OrientationBest for
horizontal (default)Compact forms and inline fields
verticalProminent upload areas with a larger drop target

Drop zone states ​

Interaction states (hover, focus, pressed, drag-over) are handled automatically. The field supports neutral and danger intents; set intent="danger" to switch the drop zone to the inline file-type error presentation from the design spec. Warning and success feedback can still be presented through individual supportingText messages.

Drop-zone copy defaults to bundled strings. Override individual lines with props or named slots (uploadLink, dragDrop, acceptHint, dragActive, errorTitle, errorHint) when you need localisation or custom markup.

Live example ​

Guidelines ​

  • Use orientation="horizontal" in dense forms; use vertical when the upload area should be the visual focus.
  • Project one catnip-file-item per file in the files slot. The input owns selection; the parent owns upload state, progress, and row actions.
  • Set native accept and mirror allowed types in acceptHint (or the acceptHint slot). Switch to intent="danger" for inline drop-zone errors (e.g. rejected file type).
  • Override drop-zone copy with props or slots (uploadLink, dragDrop, acceptHint, dragActive, errorTitle, errorHint) when defaults need localisation or richer markup.
  • Validation (size, type, count) stays in the parent — update each file item's status / message and use the input's danger intent for an invalid drop zone. Use individual supporting-text message intents for warning or success feedback.
  • Enable multiple when users may add more than one file. Drag-and-drop appends files; the native picker replaces the selection per usual file-input behaviour.

Catnip Design System by Signicat