A button that selects a tab panel inside an <orb-tabs> element.

Usage

Tab buttons go inside <orb-tabs>. Set panel to the name of the panel the button shows.

Icons

Put an element in the icon slot to show an icon before the label. It works with traditional tabs, pills, and every placement. Inline SVGs and images are sized to match the text.

Home Settings Home content Settings content Inbox Drafts Inbox content Drafts content
<orb-stack space="lg">
  <orb-tabs class="orb-radius-md">
    <orb-tab-button panel="icon-home">
      <iconify-icon slot="icon" icon="mdi:home"></iconify-icon>
      Home
    </orb-tab-button>
    <orb-tab-button panel="icon-settings">
      <iconify-icon slot="icon" icon="mdi:cog"></iconify-icon>
      Settings
    </orb-tab-button>
    <orb-tab-panel name="icon-home">Home content</orb-tab-panel>
    <orb-tab-panel name="icon-settings">Settings content</orb-tab-panel>
  </orb-tabs>
  <orb-tabs pills closable placement="start" class="orb-radius-md">
    <orb-tab-button panel="icon-inbox">
      <iconify-icon slot="icon" icon="mdi:inbox"></iconify-icon>
      Inbox
    </orb-tab-button>
    <orb-tab-button panel="icon-drafts">
      <iconify-icon slot="icon" icon="mdi:file-document-edit"></iconify-icon>
      Drafts
    </orb-tab-button>
    <orb-tab-panel name="icon-inbox">Inbox content</orb-tab-panel>
    <orb-tab-panel name="icon-drafts">Drafts content</orb-tab-panel>
  </orb-tabs>
</orb-stack>

An icon-only tab needs an accessible name. Set the label attribute on the tab button.

Grid view List view
<orb-tabs pills class="orb-radius-md">
  <orb-tab-button panel="only-grid" label="Grid view">
    <iconify-icon slot="icon" icon="mdi:view-grid"></iconify-icon>
  </orb-tab-button>
  <orb-tab-button panel="only-list" label="List view">
    <iconify-icon slot="icon" icon="mdi:view-list"></iconify-icon>
  </orb-tab-button>
  <orb-tab-panel name="only-grid">Grid view</orb-tab-panel>
  <orb-tab-panel name="only-list">List view</orb-tab-panel>
</orb-tabs>

Properties

closable

Attribute closable
Type boolean
Default false

label

Description Accessible name for the tab. Use it for icon-only tabs, which have no text to name them.
Attribute label
Type string
Default undefined

panel

Attribute panel
Type string
Default undefined

Events

orbTabClose

Description Emitted when the close button is clicked, or Delete is pressed on the tab. Call preventDefault() to keep the tab open. Otherwise the tab button and its panel are removed.
Type CustomEvent<TabCloseDetail>

Slots

Slot Description
The tab label
"icon" An icon shown before the label

Shadow Parts

Part Description
"close-button" The close button
"tab" The element with role="tab", which wraps the icon and label

Custom States

State Initial Value Description
:state(active) false The panel is currently being displayed

Dependencies

Depends on

Graph

graph TD; orb-tab-button --> orb-button orb-button --> orb-loading style orb-tab-button fill:#f9f,stroke:#333,stroke-width:4px