Skip to content
caliper ui docs

Pro

Attachment

A file or image chip for chat inputs and forms, with an upload fill, a failed state with Retry and a card for images.

Pro
pnpm dlx shadcn@latest add @caliper/attachment
Reply to Marta Silva

Ticket #4821 · Bank feed stopped syncing

Here are the October exports and the close checklist. The 2025 ledger is too large; I will split it.

  • close-checklist-q3.pdf2.4 MB
  • bank-export-october.csvUploading 20%
  • ledger-2025.xlsxOver 10 MB ·
  • dashboard-mock.png1.1 MB
Installs components/ui/attachment.tsxDepends on lucide-reactMotion none in component source

When to use

Use it for

  • Files attached to a message, a ticket or a form.
  • A queue of uploads with their own progress.

Skip it when

  • A page of files with actions per file; use the file manager or items.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

Progress is text too
The fill grows, and the chip says “Uploading 62%”, so progress does not depend on seeing the colour.
Errors say the limit and offer Retry
“Over 10 MB · Retry” tells people what to change. Remove stays available in every state.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/attachment

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source. It is built from Attachment and AttachmentList.

example.tsx
import { Attachment, AttachmentList } from "@/components/ui/attachment"

The worked example comes with Pro

The 61-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

Attachment

component

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
name *string—
sizenumber—Bytes. Shown after the name once the file is done.
state"error" | "done" | "uploading""done"
progressnumber00 to 100 while uploading. The fill grows with it and the text says it too.
errorstring—What went wrong, with the limit if there is one: "Over 10 MB".
variant"pill" | "card""pill"A pill is one line; a card shows `preview` above the name, for images.
previewReactNode—The image or icon for a card.
onRemove(() => void)—
onRetry(() => void)—

AttachmentList

component

No props of its own; it accepts the native props of its root element.

Accessibility

It is built on native elements and keeps aria-label and aria-hidden in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Files examples