Skip to content

Tabs

Tab bar + panel host: switches between ab-tab children, supports close, reorder, add.

HTML tag: c-e2a7c048642784a9e8f88cdde71294647

  • switch between views at same level
  • closable or reorderable document tabs
  • workspace with multiple panels
PropTypeDefaultDescription
tabsArray
active_tab_idString
draggableBooleantrue
show_add_buttonBoolean
closable_defaultBooleanfalse
wrap_headersBoolean
keep_aliveBooleantrue
indicator_styleStringunderline
scroll_buttonsStringnever
persist_keyString
densityStringcomfortable
appearanceStringghost
toneStringneutral
sizeStringmd
add_button_iconStringplus
add_button_labelStringAdd
is_draggingBoolean
drag_fromNumber-1
drag_overNumber-1
tab_selected_appearanceStringoutline
tab_selected_toneStringprimary
fit_to_parentBoolean
  • Define .tabs metadata array AND/OR ab-tab children; bind .active_tab_id.
  • tab-activate when selection changes; tab-close-request / tab-closed for closable tabs.
  • draggable, keep_alive, show_add_button for advanced UX.
  • Use for sibling views at same level — not hierarchical path (breadcrumb) or collapsible sections (accordion).
EventDetail
tab-activatetab_id: String
tab-close-requesttab_id: String
tab-closedtab_id: String
tab-add-request
tab-order-changeorder: Array
tab-overflowcanScrollStart: Boolean, canScrollEnd: Boolean
tab-addedtab_id: String, index: Number
SignatureDescription
activateTab(tabId: String, focusHeader: Boolean)
requestClose(tabId: String)
closeTab(tabId: String)
commitReorder(from: Number, to: Number)
addTab(tab: Object, index: Number)
setTabs(tabs: Array)
getState()

Do not use one ab-tab alone. Do not nest ab-tabs for breadcrumb-style hierarchy.

<c-e2a7c048642784a9e8f88cdde71294647 .active_tab_id=${tab} .draggable=${true} @tab-activate=${e => tab = e.detail.tab_id}>...</c-e2a7c048642784a9e8f88cdde71294647>