Skip to content
IndexRequest a UIAboutContact

Attachment Chips with States

Files attached to a chat message shown as chips that go from uploading to ready, with remove buttons and clear errors.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI mockup of a chat composer with three attachment chips above the text field: a blue image chip photo.jpg 1.2 MB with a green check, a PDF chip report.pdf 3.4 MB with a thin progress bar at 60 percent, and a red chip video.mov Too large, max 25 MB with a retry text and an x, each chip with a small remove x button, the Send button greyed with a hint Waiting for uploads, light theme, flat modern style. Negative: heavy shadows, clutter, text errors. Reduced motion: static design.

About this pattern

Definition

When people attach files to a message, each file needs a small visible card that shows its type, name, size and state. Uploading, ready and failed states must be different at a glance, and every chip needs a remove button. Errors should say what to do, such as a size limit and the maximum.

Purpose & UX principles

  • One chip per file: type icon, name truncated in the middle, size, and a state indicator.
  • Uploading: thin progress bar; ready: check; failed: red text with a reason and a retry or remove option.
  • Remove button with an accessible name that includes the file name.
  • Disable Send while any file is uploading, and say why.

Interaction states

  • Add a photo, a PDF or a file that is too large; remove chips with the x button.

Motion specification

  • Progress fills over about 1.5 seconds.
  • Reduced motion: no progress animation; state changes at once.

Responsive behaviour

  • Announce state changes politely, such as report.pdf ready.
  • Validate type and size before uploading to save time.

Code

HTML
<div class="bx"><div class="chs" id="chs" aria-label="Attachments"></div><div class="cp"><div class="two"><button class="mini" data-f="photo" type="button">Add photo</button><button class="mini" data-f="pdf" type="button">Add PDF</button></div><div class="two"><button class="mini" data-f="video" type="button">Add large video</button><button class="mini send" id="sd" type="button">Send</button></div></div><p class="out" id="out" role="status"></p></div>

Related patterns

Upload Progress & Retry

↗
Upload Progress & RetryLoading & Progress

Tag Input with Chips

↗
Tag Input with ChipsInputs & Forms

AI Prompt Composer

↗
AI Prompt ComposerAI & Conversational