Skip to content

Tabs ​

An underline tab row for switching views.

Examples ​

Basic usage ​

moonbit
@sumi.tabs(
  items=[
    @sumi.TabEntry::new("all", "All"),
    @sumi.TabEntry::new("mine", "Mine"),
    @sumi.TabEntry::new("shared", "Shared"),
  ],
  selected=current,
  on_select=set_tab.map(v => _ => v),
)

API ​

tabs ​

NameTypeDefaultDescription
items *Array[TabEntry]—Tab list
selected *String—Value of the active tab (controlled)
on_selectEmit[String]—Called with the value of the picked item
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

TabEntry::new ​

One tab.

NameTypeDefaultDescription
valueString—
labelString—
iconHtml—Leading icon

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