Attachment

A compact chip for a linked file (icon, filename, and optional size/type) with an automatic image/PDF thumbnail, plus AttachmentGroup for a wrapped row of files.

Installation

npx dafink-ui add attachment

Demo

Composition

<AttachmentGroup>
<Attachment />
</AttachmentGroup>

Props

NameTypeDefaultDescription
namestring-The filename shown in the chip. Also used to infer the file-type icon and as the fallback title (full name on hover/truncation).
hrefstring-Link target for the file. When set, the primary control renders as a real <a>; otherwise a real <button type="button">.
sizestring-Pre-formatted file size (e.g. "2.4 MB"), shown as secondary muted text.
typestring-Pre-formatted file type label (e.g. "PDF"), shown alongside size ("PDF · 2.4 MB").
icon'file' | 'image' | 'video' | 'audio' | 'archive' | 'code'inferred from nameOverrides the automatically inferred icon.
thumbnailstring-Image URL shown instead of the icon glyph. Defaults to href automatically for image-type attachments; pass explicitly for anything else (e.g. a PDF cover preview).
onClick(event: MouseEvent) => void-Fires when the primary control (link or button) is activated.
classNamestring''Additional classes merged onto the root chip wrapper.