Prodular UI

Attachment

AI

A file chip for the composer and for messages, with upload, processing, error and done states.

npx prodular-ui add attachment

States

Uploading and processing shimmer the title. Errors say why in the description.

vendor-invoices-q3.csvCSV, 214 KB
Northbeam MSA 2026.pdfUploading, 64%
Board pack, September.pdfReading 42 pages
bank-statement-sep.ofxFormat not supported

Sizes and orientation

sm inside the composer, default in messages, vertical for image grids.

payroll-oct.xlsxXLSX, 88 KB
payroll-oct.xlsxXLSX, 88 KB
payroll-oct.xlsx
receipt-uber-0921.pngPNG
receipt-hotel-0922.pngPNG
receipt-dinner-0922.pngPNG

Anatomy

<Attachment state="done" size="sm">  <AttachmentMedia><FileTextIcon /></AttachmentMedia>  <AttachmentContent>    <AttachmentTitle>invoice.pdf</AttachmentTitle>    <AttachmentDescription>PDF, 1.2 MB</AttachmentDescription>  </AttachmentContent></Attachment>

Guidance

Use it when

  • In PromptInputAttachments for files the user is about to send, and in a user Message for files they sent.
  • processing while the model reads the file, so people know it is not ready yet.

Avoid

  • Showing full file paths. Show the file name and a short description like type and size.
  • Removing failed files silently. Keep them with state error and a retry action.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Always set state: uploading while bytes transfer, processing while the file is parsed or indexed, error on failure, done when it is ready.
  • Use size="sm" inside PromptInput and the default size in messages.
  • Every AttachmentAction is icon only and needs aria-label naming the file.
  • Use AttachmentTrigger when the whole chip opens a preview. It covers the chip and keeps actions clickable.

API

Attachment

PropTypeDefaultDescription
state"idle" | "uploading" | "processing" | "error" | "done""done"Upload lifecycle. Exposed as data-state.
size"default" | "sm" | "xs""default"Chip size.
orientation"horizontal" | "vertical""horizontal"Vertical for image grids.

AttachmentMedia

PropTypeDefaultDescription
variant"icon" | "image""icon"Image fills the square with an img.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add attachment# or, with the registry in components.jsonnpx shadcn@latest add @prodular/attachment

Used in these screens