Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

File Attachments Contact Block for React

A support request on a card in card with a file drop zone: up to four PDFs or images, a progress bar per file, an error row for a wrong type, and a form that waits for the files before it sends.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A contact section for React with Base UI that takes attachments. A start-aligned header sits over a card in card: a tinted shell with + marks on its corners and a raised panel. Inside, from lg the form has two columns: name, email and the message at the start, and a File Upload drop zone at the end that takes up to four PDFs or images of at most 10 MB. Each accepted file becomes a row with its name, size, a Progress bar that fills over about a second and a remove button; a file of the wrong type or size gets its own error row with a dismiss button, and a drop that mixes good and refused files keeps the good ones. The form checks itself on submit (and asks the visitor to wait while a file is still filling), shows each problem under its field, and focuses the first one; a valid request turns into a confirmation that lists the files. On a phone the drop zone comes before the message. It's built from File Upload, Progress, Field, Input, Textarea, Frame, Guides, Shine Button and Button, with your theme's tokens for every colour. For hosting, device and software support desks that need a screenshot or a log.

FAQ

Does it really upload the files?

No. The files stay in the visitor's browser tab and the progress bars are simulated: every row advances a step every 120 milliseconds until it reaches 100 percent (instantly under reduced motion). To make it real, start your upload where a row is added (the accepted handler) and set that file's percentage from the request's progress events; the rest of the block already reads progress by file.

How do I change the types, the size or the count?

Edit ACCEPT, MAX_MB and MAX_FILES at the top of the file. ACCEPT maps a type to its extensions; REASONS turns the drop zone's reasons (wrong type, too large, too many) into the words on the error row. The limits are checked by the drop zone itself and again on your server, because a browser check is only a courtesy.

What happens when I drop good and bad files together?

The good ones are added and the refused ones get an error row. The block listens to the drop zone's accept event, not its change event: after a mixed drop the change event reports the accepted list a second time, still empty, which would wipe the good files.

Can it be used without a mouse?

Yes. The drop zone is a button that opens the file chooser with Enter or Space, every row's remove button is reachable by Tab, and after a file is removed or an error is dismissed focus returns to the drop zone. What was added, removed or refused is read out by a polite status line.

Where does the form send its data?

Nowhere yet. The submit handler waits 800 milliseconds, as a stand-in for a request, then shows the confirmation. Replace that timer in submit with your own call: details holds the name, email and message, and files the accepted files. The remove button's label names its file, and while a file is still filling the send is held with a message under the drop zone.

How does it fit on a phone?

The columns stack in reading order: name, email, the drop zone, then the message, so attaching comes before typing. The file rows truncate long names instead of widening the card, and the button goes full width.

  • Pro

    Support Channels Contact

    Support and feedback

    A support desk for a help desk tool: a band of four channels with their response times above a form with a subject, a normal or urgent priority and a message, which checks itself and confirms in place.

  • Pro

    Press Kit Contact

    Partners and creators

    A press desk with a press kit of three real files that download from the page beside a press form with an inquiry switch and a deadline date picker that marks a date within two days Rush.

  • Pro

    The portrait slot beside a customer quote is a working drop zone: drop or choose a photo and it fills the tile, with a button to remove it.

  • Pro

    A talk-to-sales split for a scheduling platform: what happens next as three numbered steps and a band of contact details beside a form that checks itself, shows each problem under its field and confirms in place.

  • Pro

    Support Ticket FAQ

    Contact and signup

    A ticket form that tries to make itself unnecessary, for a form builder: common questions at the start, and at the end a form on a card in card whose subject finds matching answers as you type.

  • Pro

    A cancellation form that asks why first: four reason cards, an offer panel that follows the reason (20% off, a smaller plan, a pause), and a confirm box, note and submit that are always there so an offer never blocks cancelling.