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.
pnpm dlx shadcn@latest add @caliper/attachmentWhen 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
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.
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
API reference
Attachment
component
Also accepts the native props of its root element and a ref.
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.
Related
- File tools templateA complete file converter site that actually works: drop a file and the home page lists only what can be done to it, and every tool page shows results as files go in, with the new size, a before and after slider and a download. Fourteen image and PDF tools and nine conversion pages run in the browser, so nothing is uploaded.
- File dropzoneDrop or choose files, with per-file progress, errors and cancel.
- Image cropCrop an image before it is uploaded. Drag the frame to move it and a handle to resize it; a rule-of-thirds grid shows while you work. A fixed shape keeps only the corner handles, and every move works from the keyboard.