--- title: Attachments description: The file-attachment tray — item chips, a remove affordance, and inline or global drop zones. source: attachments.tsx --- ## Usage guidelines - **Pending-file tray** — the strip above the composer input, showing attachment chips with a remove affordance. - **Model included** — accept matching, blob-URL lifecycle, and send preparation ship in the package; the styled tray animates items in and out. - **Media-aware** — each item exposes `data-media-type` (`image` / `pdf` / `file`) for per-type styling. - **Drop + pick** — a `Dropzone` overlay (inline, or `global` to project into the app shell) plus a `Trigger` file picker. - **Get started** — see [Installation](/docs/installation) to add the package and copy the component. ## Anatomy ```tsx 0}> {items.map((item) => ( remove(item.id)} /> ))} ``` With a drop zone and a picker trigger: ```tsx <> 0}> {items.map((item) => ( remove(item.id)} /> ))} ``` ## Accessibility `Attachments.Remove` and `Attachments.Trigger` are real buttons with default overridable names ("Remove attachment" / "Add attachment"). Pass `filename` to `Remove` so each chip announces distinctly ("Remove report.pdf") — without it, N remove buttons all read the same. `Attachments.Error` is a `role="alert"` live region: content appearing inside it announces immediately (the copy is still yours). ## API reference Every part accepts `className`, `style`, and `render` (see [PrimitiveProps](/docs/headless/types)) and emits a bespoke part attribute (`data-`) unless noted. ### Attachments The tray container; animates open/closed. Renders `data-attachments`. export const rootProps = [ { name: "show", type: "boolean", default: "true", description: "Animates the tray open or closed." }, ]; ### Attachments.Item One attachment chip. Renders `data-attachments-item`. export const itemProps = [ { name: "item", type: "AttachmentItem", default: "(required)", description: "The attachment to render." }, ]; export const itemAttrs = [ { attribute: "data-attachments-item", description: "The chip." }, { attribute: "data-media-type", values: '"image" | "pdf" | "file"', description: "The item's media category, for per-type styling." }, ]; ### Attachments.Remove Removal affordance, shown on hover. Renders `