Skip to content

Attachment

Displays an uploaded file with its upload state.

Installation

pnpm dlx shadcn@latest add @frontal-labs/attachment

Usage

import {
  Attachment,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from "@/components/ui/attachment";
<Attachment>
  <AttachmentMedia>
    <FileTextIcon />
  </AttachmentMedia>
  <AttachmentContent>
    <AttachmentTitle>release-notes.pdf</AttachmentTitle>
    <AttachmentDescription>248 KB</AttachmentDescription>
  </AttachmentContent>
</Attachment>

API Reference

Attachment

Root container.

AttachmentMedia

Thumbnail slot. Accepts variant of "icon" (default) or "image".

AttachmentContent

Wraps the title and description.

AttachmentTitle

The file name.

AttachmentDescription

Secondary text such as the file size or status.

AttachmentActions

Container for trailing actions.

AttachmentAction

An icon button rendered inside AttachmentActions. Accepts every Button prop.

AttachmentTrigger

Renders the attachment as an interactive element, for example to open a preview.

AttachmentGroup

Lays out several attachments together.

Examples

Upload States

Vertical

With an Action