Skip to content

Attachment

Open .md
Live preview

Loading example…

File chip or preview tile for prompt attachments, with an optional remove button.

import { Attachment } from "@jcsoftdev/ui/ai";

Single-component entry points tree-shake to just this component: @jcsoftdev/ui/ai/attachment.

<Attachment
name="agenda-sabado.pdf"
size="240 KB"
variant="chip"
status="done"
/>
Prop Type Default Description
name * string
size string Pre-formatted size, e.g. 240 KB.
previewSrc string Image URL (or object URL). Without it a document icon is shown.
status "done" | "uploading" | "error" "done"
progress number 0-100, only for uploading.
variant "chip" | "preview" "chip" chip is one compact line; preview is a tile with a larger thumbnail.
onRemove (() => void) Shows the remove button.

* marks a required prop.

It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).

packages/ui/src/ai/attachment/attachment.tsx