AttachmentChip

A file waiting to be sent. A ring fills around the tile while it uploads, a warning and a Retry button replace it on failure, and remove sits inside the chip. AI.

Open playground
Q3 board deck final v2.pdf2.3 MB
site-visit-notes.docxUploading, 12%
receipts-march.zipUpload failed

About

AttachmentChip is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { AttachmentChip } from "@ashutoshswamy/smoui" and set name, size, type among its 6 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { AttachmentChip } from "@ashutoshswamy/smoui";

<AttachmentChip name="deck.pdf" size={2411724} type="application/pdf" onRemove={remove} />
<AttachmentChip name="notes.docx" status="uploading" progress={0.4} />

Props 6

name

File name. Long names truncate with an ellipsis.

string
size

Bytes, shown as KB or MB.

number
type

MIME type, picks the icon.

string
previewUrl

Image preview shown in the tile.

string
status / progress

Upload state and its ring.

"uploading""done""error" / 0 to 1default "done"
onRemove / onRetry

Remove button, and Retry on error.

() => void