Uqudo UIregistry

Attachment

Displays a file attachment with media, title, description and actions.

quarterly-report.pdf2.4 MB

Installation

npx shadcn@latest add @uqudo/attachment

Installing it also installs Button, which AttachmentAction is built on.

Usage

import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from "@/components/uqudo/ui/attachment"
<Attachment>
  <AttachmentMedia>
    <FileTextIcon />
  </AttachmentMedia>
  <AttachmentContent>
    <AttachmentTitle>quarterly-report.pdf</AttachmentTitle>
    <AttachmentDescription>2.4 MB</AttachmentDescription>
  </AttachmentContent>
  <AttachmentActions>
    <AttachmentAction aria-label="Remove">
      <XIcon />
    </AttachmentAction>
  </AttachmentActions>
</Attachment>

Attachment is a bordered card that lays out a media slot, a text block and a row of actions. Every part is optional: the padding adapts to whether AttachmentMedia or AttachmentContent is present, so a bare thumbnail and a full row with actions both look right.

The state prop reflects an upload lifecycle. idle draws a dashed border, uploading and processing add a shimmer to the title, and error turns the border, media and description destructive.

To make the whole attachment clickable, add an AttachmentTrigger. It renders an invisible button stretched over the card; keep the real actions inside AttachmentActions, which is layered above the trigger so they stay clickable.

Examples

Group

AttachmentGroup lays attachments out in a horizontally scrolling, snapping row.

quarterly-report.pdf2.4 MB
budget-2026.xlsx840 KB
roadmap.key12.1 MB

Sizes and states

quarterly-report.pdfSize default
quarterly-report.pdfSize sm
quarterly-report.pdfSize xs
Uploading…State uploading
Upload failedState error

Image

AttachmentMedia with variant="image" stretches its child to fill the square. Combine it with orientation="vertical" on Attachment for a thumbnail-first layout.

team-photo.jpg1.8 MB
team-photo.jpg1.8 MB

API Reference

Attachment

Prop

Type

AttachmentMedia

Prop

Type

AttachmentAction

A ghost, icon-sized Button. Give each one an aria-label.

Prop

Type

AttachmentTrigger

Prop

Type

Other parts

These forward className and every prop of the element they render.

ComponentRendersNotes
AttachmentGroup<div>Horizontal scroll-snap row; children are fixed-width.
AttachmentContent<div>Flexible text block; truncates its children.
AttachmentTitle<span>Medium weight, single line. Shimmers while uploading.
AttachmentDescription<span>Muted, small text. Turns destructive in the error state.
AttachmentActions<div>Action row layered above AttachmentTrigger.

Data attributes

AttributeElementValue
data-slotallattachment, attachment-group, attachment-media, attachment-content, attachment-title, attachment-description, attachment-actions, attachment-action or attachment-trigger.
data-stateAttachmentThe resolved state.
data-sizeAttachmentThe resolved size.
data-orientationAttachmentThe resolved orientation.
data-variantAttachmentMediaThe resolved variant.

On this page