Chat Attachment
A compact attachment surface for the composer and sent messages — name, meta, preview, upload progress and status.
A compact attachment surface shared by the composer (files queued to send) and sent messages (files already attached). It owns the visual hierarchy, upload-progress treatment and status affordances; the host supplies the localized name/meta, an optional preview thumbnail or icon, and any actions.
Import
1import { ChatAttachment } from "@yuhuanowo/yunui/chat";Basic
Basic
Uploading
Set status="loading" and a progress (0–100) to render a determinate bar and a spinner. Omit progress for an indeterminate spinner only.
Uploading
Error
status="error" tints the surface and swaps in an alert glyph; the meta line carries the reason.
Error
With actions
Pass actions (e.g. an IconButton to remove) — they sit on the trailing edge of the row.
With actions
Props
ChatAttachment also forwards any <div> HTML attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
| actions | ReactNode | — | |
| icon | ReactNode | — | |
| meta | ReactNode | — | |
| name* | ReactNode | — | |
| preview | ReactNode | — | |
| progress | number | — | |
| status | "idle" | "loading" | "error" | idle |