Skip to content

Attachment Strip ​

A row of 48px attachment tiles — cover-fit image thumbnails and slate-gradient document placeholders — followed by an add tile. Hovering a tile reveals its 8px remove badge. Past max_visible items the row clips, a right-edge fade appears, and the add tile pins over it.

Examples ​

Add & remove ​

moonbit
@sumi.attachment_strip(
  items=[
    @sumi.AttachmentItem::image("cover.png", label="Cover"),
    @sumi.AttachmentItem::document("Brief.pdf"),
  ],
  on_add=pick_files,
  on_remove=set_items.map(i => c => remove_at(c, i)),
)

API ​

attachment_strip ​

NameTypeDefaultDescription
items *Array[AttachmentItem]—Attachments to render, in order
on_addCmd—Adds the trailing add tile; in overflow it pins to the right edge
on_removeEmit[Int]—Emitted with the item index from the hover badge
max_visibleInt10Visible tile cap before the fade + pinned add (default 10)
aria_labelString"Attachments"Strip label (defaults to "Attachments")
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

AttachmentItem::image ​

An image attachment.

NameTypeDefaultDescription
srcString—
labelString"Image attachment"Alt text (defaults to "Image attachment")

AttachmentItem::document ​

A non-image attachment, rendered as a gradient placeholder.

NameTypeDefaultDescription
labelString—

AttachmentKind ​

VariantDescription
ImageCover-fit thumbnail tile
DocumentSlate-gradient placeholder with a document glyph

* required (labelled) parameter — everything else is optional.