Skip to content
kitn AI/UI

Attachments

kai-attachments

Render a set of file attachments — one element, three presentations chosen by a single attribute. Tiles for a gallery, chips for inline, rows for a list.

  • Shadow DOM
  • 3 variants
  • Hover-card preview
  • Removable items

Set items in JavaScript (arrays can’t be HTML attributes); choose the presentation with the variant, hover-card, and removable attributes; listen for kai-remove.

variant="grid" — square image tiles for a gallery.

variant="inline" — a compact icon + label chip per file, for a composer or message body.

variant="list" — full-width rows with a preview thumbnail, filename and media type.

Add removable for a per-item remove button (the ×); it fires the kai-remove event.

Add hover-card to reveal each item’s details on hover — useful on grid, where the tile shows only the image.

PropertyTypeDefaultNotes
items [] The attachments to render. Set as a JS property (array).
variant 'grid' Layout: `grid` = visual tiles, `inline` = icon + label chips, `list` = rows.
hoverCard false Wrap each item in a hover card that previews its details.
removable false Show a remove button per item; clicking it fires a `kai-remove` event.
showMediaType false Also show the media type beneath the filename (non-grid variants).
emptyText Text shown when `items` is empty.
EventDetailNotes
A remove button was clicked.

This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.

AttachmentsAttachmentAttachmentPreviewAttachmentInfoAttachmentRemoveAttachmentHoverCardAttachmentHoverCardTriggerAttachmentHoverCardContentAttachmentEmpty