Attachment
Displays file attachments with media previews and actions, for chat composers, uploads, and message threads.
Installation
Bash
Usage
Built for chat composers, message threads, and upload lists. Wrap
multiple attachments in AttachmentGroup for a snap-scrolling row. The
state prop drives the upload lifecycle styling: idle renders a
dashed border, uploading/processing shimmer the title, and error
turns the media and description destructive.
Examples
Image cards
orientation="vertical" turns attachments into image-first cards —
suited for photo pickers and gallery uploads.
Actions and upload state
AttachmentActions holds buttons that stay clickable above the
full-card AttachmentTrigger (the trigger sits behind them in stacking
order). Icon-only actions and triggers need aria-labels.
API reference
Attachment
Extends div.
| Prop | Type | Default |
|---|---|---|
size | "default" | "sm" | "xs" | "default" |
orientation | "horizontal" | "vertical" | "horizontal" |
state | "idle" | "uploading" | "processing" | "error" | "done" | "done" |
AttachmentMedia
Extends div.
| Prop | Type | Default |
|---|---|---|
variant | "icon" | "image" | "icon" |
image expects an img child and dims it while uploading; icon sizes
a single icon (or a spinner during uploads).
AttachmentAction
Extends Button — all Button props apply.
Defaults to variant="ghost" and size="icon-xs".
AttachmentTrigger
An invisible full-card button (swap the element via the Base UI
render prop, for example render={<a href="…" />}). Give it an
aria-label describing the open/preview action.
AttachmentGroup, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentActions
Structural wrappers (div/span) accepting standard element props.