Products · Components

Tab

One tab in Tabs, with its label, and an optional icon and count badge.

Goes inside Tabs.

Children: Nothing

Example

Tab is used inside Tabs:

The Tabs component
view.dml
<Tabs value="{{ tab }}" variant="segmented" onChange="setTab">
  <Tab value="all" label="All" />
  <Tab value="sent" label="Sent" />
  <Tab value="received" label="Received" badge="3" />
</Tabs>
controller.ts
export default definePage({
  initialState: { tab: 'all' },
  mutations: {
    setTab: (_state, event: ValueEvent) => ({ tab: event.detail.value }),
  },
});

Props

PropTypeWhat it is
valuestringWhat the Tabs' onChange sends when the person chooses this tab.
labelstring
iconicon name, or one of your own iconsBefore the label, or over it in a bar.
badgenumberA count shown next to the label, or on the corner of a bar tab's icon, such as unread items.
disabledbooleanDims it, and the person can't use it.

Events

None.

Keep reading

On this page