Attachments
AttachmentStrip: a horizontally scrolling strip of image thumbnails and file chips (icon, name, type and size). Images open a Lightbox, files open their link, max adds a +N button. AttachmentThumb renders one. Agents get openAttachment(id).
Installation
Copy code
npm packages
lucide-reactUsage
ImportCopy code
API reference
AttachmentThumb
| Prop | Type | Default |
|---|---|---|
attachmentrequired | Attachment | – |
size | "sm" | "md" | "md" |
onOpenRuns on a press; `event.preventDefault()` stops a file's link from opening. Without it, an image is static. | (attachment: Attachment, event: MouseEvent<HTMLElement>) => void | – |
openLabelThe accessible name of an image's button. | (name: string) => string | defaultOpenLabel |
locale | string | – |
className | string | – |
AttachmentStrip
| Prop | Type | Default |
|---|---|---|
attachmentsrequired | readonly Attachment[] | – |
onOpenRuns before an attachment opens, for a person or an agent; `details.cancel()` keeps it closed. | (attachment: Attachment, details: ChangeDetails<AttachmentOpenReason>) => void | – |
maxShows this many, then a "+N" button for the rest. | number | – |
size | AttachmentSize | "md" |
labels | Partial<AttachmentLabels> | – |
locale | string | – |
aria-labelrequired | string | – |
Also takes <div> attributes and render except children, onSelect.
Other exports
attachmentsformatFileSizeattachmentLabelstype Attachmenttype AttachmentOpenReasontype AttachmentsOptionstype AttachmentSizetype AttachmentThumbPropstype AttachmentLabelstype AttachmentStripPropsAccessibility
- The strip needs an aria-label; images open the lightbox and focus returns to the thumbnail.
Agent actions
Agents call openAttachment; onOpen runs first and can cancel.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.