Shadcn Attachment
Browse 6 production-ready shadcn attachment components for AI chat composers, upload queues, and file pickers. Attachment is compatible with Radix UI and Base UI composition and fully aligned with Shadcn Create, so radius, colors, and typography match your design tokens.
For AI Agents
Hand your agent this brief or the ReUI MCP, not a screenshot. Free to install.
When to use
- Files carried by a chat turn, as chips in a composer tray or cards in an assistant reply
- Upload queues and pickers where each file reads as idle, uploading, processing, failed or done
- Rows of image thumbnails or file chips that scroll sideways on one line instead of wrapping
When not to use
- A drop zone that takes files dragged in from the desktop: use the File Upload component
- A colored format badge that labels a document by its extension, such as PDF: use the File Type component
- An upload list where each row needs a bar filling toward 100 percent: use the Progress component
Agent notes
Attachmentuploads nothing and only styles thestateyou pass, so setstatefrom your own transfer code- The radix
ButtonbehindAttachmentActionsets notype, so passtypebutton inside aformor it submits
https://web.dev.reui.io/components/attachment.mdget_component("attachment")npx shadcn@latest add attachmentShadcn Attachment: File Chips, Upload States, and Image Previews
Shadcn Attachment is a file chip built from parts: a media slot, a title, a description, an actions row, and an optional full-card trigger. The root draws its own border, card background, and radius, so it drops into a composer or a reply without a wrapper. It ships in both twins, Base UI and Radix, and all 8 Shadcn Create styles carry their own attachment rules.
One state prop covers the lifecycle: idle, uploading, processing, error, and done. Idle gets a dashed border, uploading and processing shimmer the title, and error switches the border, the media, and the description to the destructive color, so a failed file reads as failed without extra markup.
ReUI shows attachment components where they actually appear: assistant replies, composer trays, snapping image strips, upload queues, and file pickers, next to Shadcn Input Group and Shadcn Field. The sections below cover what the component is, why teams use it, the features that matter, and how to wire it to real uploads.
What is Shadcn Attachment?
An attachment is the small card that stands in for a file: an icon or a thumbnail, the file name, one line of metadata, and whatever actions the file allows. Shadcn Attachment splits that into 9 parts, from AttachmentMedia and AttachmentTitle through AttachmentActions to AttachmentGroup, so the same markup holds whether the card is a dense composer chip or a full-width row.
The parts carry the fiddly details. Title and description truncate instead of wrapping, so a long file name cannot push the actions off the row. AttachmentMedia with variant="image" crops a child image square, so thumbnails line up without sizing classes of their own. AttachmentGroup is a scrolling, snapping row with the scrollbar hidden, so the fifth file scrolls into view instead of adding a second line.
Why Use Shadcn Attachment?
Teams hand-roll this card and hit the same 3 problems: the file name wraps and breaks the row, the failure state is a red border with no reason beside it, and a click overlay on the card swallows the remove button. Attachment answers all 3 in the primitive, with truncation on the text parts, a description that stays legible in the error state, and a trigger layered under the actions row so both keep their hit areas.
The 6 components on this page are the parts, not the finished product. The assembled surface is Pro: 9 of the 12 AI Chat blocks import this same Attachment, inside streaming threads, reply details, and composers that hold their own context chips. Copy a chip from this page, or start from a chat surface that already has one.
Shadcn Attachment Features
- 5 Upload States on One Prop. state accepts idle, uploading, processing, error, and done. Idle draws a dashed border, uploading and processing shimmer the title, and error recolors the border, the media, and the description.
- Media Slot for Icons or Images. AttachmentMedia is a square, centered box. Set variant="image" and a child image is cropped to fill it, so a strip of thumbnails lines up without per-image classes.
- Truncating Title and Description. Both text parts truncate at the card width. Long file names and long error messages stay on one line, and the actions keep their place at the end of the row.
- Actions Over a Full-Card Trigger. AttachmentAction renders a Shadcn Button as a ghost icon button by default. AttachmentTrigger covers the card for select or preview and sits under the actions row in the stacking order, so a remove button still receives its click.
- Scrolling, Snapping Group. AttachmentGroup keeps chips on one line, hides the scrollbar, and snaps each card into place, so a composer tray never grows a second row when another file is added.
- 3 Sizes and 2 Orientations. size takes default, sm, and xs, and orientation takes horizontal and vertical. The same markup becomes a dense composer chip or a vertical thumbnail card, with padding and media size set per style.
- Shadcn Create Compatible. All 8 Shadcn Create styles (Vega, Nova, Maia, Lyra, Mira, Luma, Sera, and Rhea) carry their own attachment rules, so the card runs from square corners in Lyra to a deep radius in Luma with no markup change.
Wiring Attachment to a Picker and an Upload Queue
Attachment renders state, it does not move bytes. For picking, pair it with the useFileUpload hook from Shadcn File Upload: render a card in the idle state, put openFileDialog on the AttachmentTrigger that covers it, spread getInputProps onto a visually hidden input, and call removeFile from the action on each chip.
For a queue, hold your own rows and map transfer status onto state: uploading while bytes move, processing while the file is scanned or parsed, error with the reason written into AttachmentDescription, done when it lands. Show a Shadcn Spinner inside AttachmentMedia while a file is in flight, and put the percentage in the description or beside the card with Shadcn Progress.
Integrating With Other Components
For a composer, put AttachmentGroup in a block-start Shadcn Input Group addon above the textarea, with the attach and send controls in the block-end addon. Wrap the whole control in a Shadcn Field for the label and helper text, and use Shadcn Button for the actions the chips do not own.
In a thread, attachments sit inside Shadcn Bubble or Shadcn Message parts as the files a turn carried. Use Shadcn Empty for the state before anything is attached, Shadcn Tooltip to show a file name that had to truncate, and Shadcn Dropdown Menu when a chip needs more than 2 actions.
For uploads, combine attachments with Shadcn File Upload for the picker and Shadcn Progress or Shadcn Spinner for transfer state. When you want the finished surface rather than the parts, AI Chat has 12 Pro blocks, 9 of which already import Attachment across 16 files, wired into threads, composers, and reply details.
AI Chat Blocks in ReUI Pro
The free examples above pair with 13 production ready ai chat blocks in ReUI Pro, complete sections built on the same primitives and ready to copy into your app.
- AI Chat (13 blocks)Conversation surfaces for AI products, from full chat shells to embeddable threads, sheets, and launchers.
Frequently Asked Questions
What is a Shadcn Attachment used for in real products?
Does Shadcn Attachment upload files?
How do I show upload progress on an attachment?
How do I make the whole card clickable and still keep a remove button?
What is the difference between Attachment and Item?
How do I keep a row of attachments from wrapping onto a second line?
Is Shadcn Attachment accessible out of the box?
Start building with ReUI Pro today.
Every Pro block, every style, and every future addition, with one license for unlimited projects.
From $249, once. Lifetime updates.