File Item
A file item represents a single file in a list. It shows the file name, size, status, and contextual actions such as download, delete, cancel, retry, or dismiss.
The bottom upload indicator is provided by catnip-progress, composed in its bar-only presentation. File Item owns the file-specific percentage and state; Progress owns the reusable bar and progress semantics.
Overview
The catnip-file-item component renders one row per file. Use it anywhere you need to display files — attached documents, upload progress, download lists, or validation feedback — not only inside a file input.
Common patterns:
- Read-only file list: Show uploaded or attached files (
status="ready"). SetshowDownloadandshowDeletetofalsewhen the row has no actions. - Upload flow: Show progress and errors while files are being added (
inProgress,warning,danger). - Future file input: A parent file input can compose multiple file items below its drop zone.
Statuses
| Status | Purpose | Actions |
|---|---|---|
ready | File is available | Download, delete (showDownload / showDelete can hide them) |
inProgress | Upload is running. Metadata shows uploading-progress next to the percentage. | Cancel |
done | Upload just completed | Download, delete (showDownload / showDelete can hide them) |
warning | Non-critical validation issue | Retry, dismiss |
danger | Upload or validation failed | Retry, dismiss |
Sizes
m(default): Compact row for dense lists.l: Taller row with larger typography and action targets.
Live example
Guidelines
- Use
readywhen displaying files the user can download or remove — for example an attachments list or a completed upload summary. SetshowDownloadandshowDeletetofalsefor a read-only row. - Use
inProgresswhile an upload is running. Bindprogress(0–100) and handlecancelto abort the upload. The metadata row uses theuploading-progressicon next to the percentage. - File Item composes
catnip-progressfor its bottom bar. Do not add a second progress indicator for the same upload. - Use
warningfor recoverable validation issues (for example file too large). Provide a clearmessageand handleretry/dismiss. - Use
dangerfor failed uploads. Provide a concisemessageexplaining what went wrong. - Render one
catnip-file-itemper file. The parent (file input, page section, or modal) owns file data, upload orchestration, and list order. - Prefer size
min dense layouts; uselwhen there is more vertical space or larger touch targets are needed.