Attachment

Displays a file or image attachment with media, metadata, state, and actions.

Installation

npx shadcn@latest add @fulldev/attachment

Usage

---
import FileIcon from "@lucide/astro/icons/file"

import {
  Attachment,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from "@/components/ui/attachment"
---

<Attachment>
  <AttachmentMedia><FileIcon /></AttachmentMedia>
  <AttachmentContent>
    <AttachmentTitle>report.pdf</AttachmentTitle>
    <AttachmentDescription>2.4 MB</AttachmentDescription>
  </AttachmentContent>
</Attachment>

Attachment is a presentation component. It does not select, upload, remove, or persist files.

Examples

Sizes

Vertical Group

States

States provide visual status only. Your application owns the upload lifecycle and supplies truthful status text.

Native File Input

Use a native file input to let someone choose files. Rendering selected files as attachments requires application state and is separate from this static component.

API Reference

Attachment

PropTypeDefaultDescription
state"idle" | "uploading" | "processing" | "error" | "done""done"Visual file state.
size"xs" | "sm" | "default""default"Controls spacing and type size.
orientation"horizontal" | "vertical""horizontal"Controls card layout.

AttachmentMedia accepts variant="icon" | "image". AttachmentAction uses the Button API and supports as. AttachmentTrigger is polymorphic and covers the card, so give it visible or screen-reader-only link text. All parts forward native attributes.

See the GitHub source code for the component source.