Attachment
A React component in Beamline's AI & agents category.
A file tile: preview or typed glyph with the type named, name, size, upload progress, error with retry, and a keyboard-reachable remove.
Use it for
- Files attached to a composer, message or form.
Not for
- Choosing files (file-dropzone).
- Retrieved document chunks (context-cards).
Anatomy
- preview or type glyph
- name: one line, cut with an ellipsis; the full name on hover
- name
- type · size, or progress, or error
- retry
- remove (20px drawn, 24px hit area)
- progress bar
- AttachmentList (role list, each child a list item): as many 12.5rem columns as the room holds, one full-width column when it holds fewer
- AttachmentGlyph / fileKind(name)
- shape: a card (the look's card radius); the preview or type tile and the open button's focus ring take the frame radius minus its inset (never more), so the corners stay concentric in every look, at any roundness and spacing
Variants
- size: sm, md
States
- ready
- uploading (announced; the bar grows to each value)
- finished (a bar seen uploading fills, then fades)
- error (announced, Retry)
- openable (onOpen: the whole tile steps one rung on hover)
Keyboard
- The tile opens (if onOpen); Retry and Remove are named buttons; Remove appears on focus (always on touch screens).
Motion
Remove waits for attention (.reveal in the tile: hover, focus inside, always on touch). Progress grows by transform to each value; an upload that finishes fills its bar, then the bar fades. An openable tile steps one rung on hover at once and leaves over --pui-motion-out; Retry presses (.ix). In an AttachmentList a new file grows in, the grid makes room, and a removed file fades where it stood (useFlip).
Props
| Prop | Type | Default | Description |
|---|---|---|---|
file (required) | { id, name, size?, preview?, progress?, error? } | — | File record displayed as an attachment. Required. |
onRemove / onRetry / onOpen | (id) => void | — | onRemove: Runs the remove action for the chosen item; no handler by default. onRetry: Runs the retry action for the failed operation; no handler by default. onOpen: Opens the chosen attachment; no handler by default. |
size | "sm" | "md" | — | sm 32px glyph (composers, messages), md 40px (lists, forms). |
AttachmentList: label | string | — | label: On AttachmentList: Visible label or accessible name for the control. Defaults to "Attachments". |
style / ref | CSSProperties / native Ref | — | style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default. |
classNames | AttachmentClassNames | — | Classes for the named visual parts; no part overrides by default. |
compact | boolean | — | On AttachmentGlyph: Use the 20px tile instead of the regular size; defaults to false and overrides size=xs. |
style | CSSProperties | — | Inline styles on the documented visual root; no inline overrides by default. |
onRemove | ((id: string) => void) | — | Runs the remove action for the chosen item; no handler by default. |
onRetry | ((id: string) => void) | — | Runs the retry action for the failed operation; no handler by default. |
onOpen | ((id: string) => void) | — | Opens the chosen attachment; no handler by default. |
className | string | — | Classes on the documented visual root; no override by default. |
ref | Ref<HTMLDivElement> | — | Receives the documented root element; no ref by default. |
AttachmentGlyph.name (required) | string | — | On AttachmentGlyph: File name whose extension determines the glyph. Required. |
AttachmentList.children (required) | ReactNode | — | Content rendered inside the component. Required. |
AttachmentList.label | string | — | On AttachmentList: Visible label or accessible name for the control. Defaults to "Attachments". |
Used in
- Agent builder
- AI agent workspace
- Change orders
- Guest messages
- Helpdesk inbox
- Knowledge base manager
- Submittal register
- Team chat
Dependencies
lucide-react
Import
import { AttachmentGlyph, Attachment, AttachmentList } from "@beamline/attachment";
Get it
Attachment is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent
More in AI & agents
- Image generation: The frame an AI image is generated into: a field of brand-hued pixels breathes with the progress while the model works, then the image arrives —…
- Flowchart: A workflow as steps on a dotted canvas: a trigger, conditions that branch into paths side by side, actions and waits, read top to bottom; during a run…
- Run trace: One agent run as a waterfall: every step (model calls, tools, retrieval, checks, sub-agents) nested under the step that started it, each a bar on a…
- Run theatre: One agent run as a theatre: the Run trace's waterfall under a transport (play, scrub, speed) that replays the run as it happened. Pick a step and re-run…
- Answer compare: Two answers to the same prompt side by side, and a person's verdict: A is better, a tie, B is better, or both are bad, with the reasons that decided it…
- Branch navigator: The versions of an assistant conversation that forked when a message was edited or an answer regenerated: a “‹ 2 / 3 ›” switch on each message that has…
- Response: An assistant's answer as streamed markdown in the system's reading type: bursty tokens flow in at an even pace, each new word fades in through a short…
- Chat thread: People talking to people: messages grouped by person and day, reactions, delivery and read receipts that glide to the newest message read, who is typing…
- Model picker: Choose the AI model for a request by what it can do and what it costs: a trigger with the model's name opens a searchable list grouped by provider, with…
- Task rows: Background work an agent is doing, one row per task: status as a glyph and a word, what it produced, how long it has run or took, a progress bar while…
- Conversation: The scrolling column of a conversation: follows new content while you are at the bottom, stops when you scroll up to read, and offers a way back; shared…
- Context cards: The knowledge an agent retrieved before it answered: one card per chunk with what it is about, the text it read with the search words marked, how…
- Prompt suggestions: Ready-made prompts a person can start from or follow up with: chips, cards or a list; a picked one lifts off and flies into the composer as its text…
- Plan: An agent's plan: numbered steps with live status, progress, and Approve / Edit / Reject when it needs sign-off; approving shows progress, and a refusal…
- Approval card: The agent stops and asks before it acts: what it wants to do, exactly what that changes, any choices it needs, and Approve or Reject; both run your…
- Tool call: One tool call in an agent's run: status, what it did and a short result on one quiet row that opens to the exact input and output; stops for permission…
- Recommendation card: One suggestion from the agent that the person may take or leave: what it suggests, why, the expected effect and how sure it is (a meter and a word…
- Citations: Inline numbered citations that preview their source on hover or focus, plus a numbered source list; streamed answers flow in at an even pace with the…
- Reasoning: The agent's trace, fed by your stream: a shimmering label and the seconds so far while it works, then "Thought for N seconds"; steps that check off…
- Prompt bar: The agent composer: a field that grows, @ to add a source, / for a command, a model picker, files and dictation, and one button that sends with progress…
- Selection actions: Select a passage and hand it to the agent: a bar over the selection with quick actions, your own instruction and More; while the agent works it says so…
- Message: One turn in a conversation with an agent: the person's words in a quiet bubble, the agent's answer on the page with its orb mark, trace, tool calls and…