Content
Attachment
A file chip or card for things attached to a message or a composer, with a tinted letter glyph per file kind and upload progress.
Group: Content. Exports: Attachment. Halaska addition with no shadcn/ui equivalent.
Usage
import { Attachment } from "./halaska-kit";
Attachment props
namestring(default "refund-policy.pdf"): File name, truncated in the middle of the row when long (default: "refund-policy.pdf")kind"image" | "pdf" | "doc" | "sheet" | "code" | "audio" | "file"(default "pdf"): Picks the two or three letter glyph and its tint (default: "pdf")sizestring(default "1.2 MB"): Human size shown beside the name, for example "1.2 MB" (default: "1.2 MB")status"uploading" | "ready" | "failed"(default "ready"): Ready shows the glyph, uploading shows progress, failed tints the tile and says so (default: "ready")progressnumber(default 0): 0 to 100 while uploading (default: 0)thumbnailstring: Image url, used in the tile for kind "image" only (default: undefined)variant"chip" | "card"(default "chip"): Chip is one line for a composer; card adds a second line and a progress bar (default: "chip")onRemove() => void: Shows a labelled remove button and fires when it is pressedonOpen() => void: Makes the name a button that fires when pressed
Accessibility
- Each attachment is a group named with the file name and its size or state, for example refund-policy.pdf, 1.2 MB.
- The remove button is named with the file, for example Remove refund-policy.pdf.
- With onOpen the file name is a real button; without it the name is plain text.
- Upload progress is a progressbar with its current value; the failed state is also written out, not only tinted.
Known gaps
- No retry callback in the failed state.
- No drag handle or reordering.
Halaska UI · Components · Patterns · Screens · Install