DocsSupportPricing
Roadmap (has updates coming soon)XFigma3.7K
Sign inGet All-Access
  1. Components
  2. Attachment
MarkdownPro 13 blocks

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

  • Attachment uploads nothing and only styles the state you pass, so set state from your own transfer code
  • The radix Button behind AttachmentAction sets no type, so pass type button inside a form or it submits
Markdownhttps://web.dev.reui.io/components/attachment.md
MCPget_component("attachment")
Installnpx shadcn@latest add attachment
Full index for agents:llms.txtReUI MCP setup

Shadcn 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.

Browse all AI & Agents blocks

Frequently Asked Questions

What is a Shadcn Attachment used for in real products?

Chat composers that hold files before a message is sent, assistant replies that return a document, upload queues in settings and support forms, and file pickers. Anywhere a file needs a name, a size, a state, and a way to remove it, the attachment card is the row.

Does Shadcn Attachment upload files?

No. It is presentational: it renders the card and reflects the state you pass in. Use your own transfer code, or the useFileUpload hook from Shadcn File Upload for the file dialog, size and type validation, and preview URLs.

How do I show upload progress on an attachment?

Set state to uploading and the title shimmers on its own. Put the percentage in AttachmentDescription, the line that stays readable at every size, or render a Shadcn Progress bar beside the card when the transfer is long enough to watch.

How do I make the whole card clickable and still keep a remove button?

Use AttachmentTrigger. It covers the card as an overlay and sits below AttachmentActions in the stacking order, so the remove button keeps its own hit area. To render the trigger as a link instead of a button, use render in the Base UI twin or asChild in the Radix twin.

What is the difference between Attachment and Item?

Shadcn Item is the general row: media, title, description, actions. Attachment is the file-specific version. It adds the state lifecycle, square image cropping in the media slot, and AttachmentGroup for a scrolling tray. Use Item for list rows, Attachment for files.

How do I keep a row of attachments from wrapping onto a second line?

Wrap the chips in AttachmentGroup. It holds every card at its own width and scrolls horizontally with snapping, so a fifth file never changes the height of a composer. If the cards carry no buttons, give the group a tabIndex so keyboard users can still scroll it.

Is Shadcn Attachment accessible out of the box?

The parts give you the structure, you own the labels. Give icon-only actions an aria-label that names the file, keep the failure reason in AttachmentDescription so the error is not carried by color alone, and announce count changes in a live region when chips can be added and removed.
Previous8 Shadcn Aspect Ratio Components
Next12 Shadcn Autocomplete Components

Start building with ReUI Pro today.

Every Pro block, every style, and every future addition, with one license for unlimited projects.

Get All-Access

From $249, once. Lifetime updates.

Application

  • App Shell
  • Auth
  • Card
  • Dashboard
  • Dialog
  • Empty State
  • Event Calendar
  • Flow
  • Form
  • Gantt
  • Kanban Board
  • List
  • Navbar
  • Onboarding
  • Profile
  • Rich Text Editor
  • Schedule
  • Settings
  • Sheet
  • Stats2 meter cards moved here from Charts, 17 in all
  • Timeline
  • Whiteboard
  • Wizard

Data Grid

  • Base
  • AdvancedAdded 2 new Data Grid Advanced blocks, 5 in all
  • Columns
  • Drag & Drop
  • Editing
  • Expansion
  • Filtering
  • Grouping
  • Virtualization

Charts

  • Area ChartAdded a new Inbound Leads area chart block
  • Bar Chart
  • Composed Chart
  • Line Chart
  • Pie Chart
  • Radial Chart
  • Sankey ChartNew Sankey Chart category with 3 flow chart blocks
  • Slope ChartNew Slope Chart category with 2 rank-shift chart blocks
  • Sparkline
  • Status Tracker

AI & Agents

  • AI Chat
  • Agent Activity
  • AI UsageNew AI Usage category with 2 spend blocks

Solutions

  • Dev Ops
  • AI Ops
  • CRM
  • Agents
  • Analytics
  • Billing
  • Bookings
  • Files
  • Inventory
  • Users
  • Digital TwinNew Digital Twin category with 2 interactive 3D blocks

Templates

  • All templates

eCommerce

  • Category Card
  • Checkout
  • Comparison
  • Coupon
  • Filter Sidebar
  • Product Card
  • Product Detail
  • Product Grid
  • Receipt
  • Review
  • Shopping Cart
  • Wishlist
  • Shop Hero

Marketing

  • Blog
  • Compare
  • Contact
  • CTA
  • FAQ
  • Hero
  • How It Works
  • Pricing

Resources

  • Components
  • Blocks
  • Icons
  • MCP for Agents
  • Docs
  • Support
  • Pricing
  • Tailwind Plus Alternative
  • Roadmap(has updates coming soon)
  • AffiliateSoon

Legal

  • Privacy Policy
  • Terms & Conditions
  • License
  • Refunds
  • Cookies

© 2026 ReUI. All rights reserved.

3.7K

Single file attachment in an assistant reply

Composer tray with removable attachments

Image thumbnails in a snapping strip

Three sizes carrying three levels of an answer

Upload queue across all five states

File picker that fills an attachment tray