Tab List

Alignment target:@astryxdesign/core v0.7.1 · TabList

Usage #

Import TabList and Tab from their dedicated entry and control selection with v-model:value.

Vue
<script setup lang="ts">
import { Tab, TabList } from '@astryx-vue/core/TabList'
import { ref } from 'vue'

const value = ref('overview')
</script>

<template>
  <TabList v-model:value="value">
    <Tab value="overview">
      Overview
    </Tab>
    <Tab value="props">
      Props
    </Tab>
    <Tab value="examples">
      Examples
    </Tab>
  </TabList>
</template>

Anatomy

ElementDescription
Left ContentMost important area; hugs content width.
Center-Fill ContentStretches to fill available space.
Right ContentHugs content width.

Best practices #

GuidancePractice
RecommendedLeave role unset for a navigation landmark that marks the current tab with aria-current="true". Set role="tablist" to opt into the tabs pattern, with role="tab" and aria-selected. Tabs wider than the strip scroll sideways by default.
RecommendedGive each Tab a unique value for selection and keyboard navigation.
RecommendedUse disabled for unavailable tabs; keyboard navigation skips them automatically.
Don'tPut too many tabs in a single strip; consider scrolling or reorganizing content when it overflows.
Don'tUse TabList for page-level navigation; Breadcrumbs or Link are better for wayfinding.

Examples #

Tab List — Fill layout

Open in Playground

With layout set to fill, the tabs share the width of the row and a divider sits under the list.

Tab List — With actions

Open in Playground

Tabs stay on the left and the filter and create buttons sit on the right. With a divider, the buttons use the same size as the tabs.

Tab List — With badge

Open in Playground

A badge after the label. Error is for a count that needs attention; neutral is for an ordinary count.

Tab List — With icons

Open in Playground

An icon before the label, so each tab is recognizable before the word is read.

Tab List — Scrolling strip

Open in Playground

When the tabs are wider than the strip, it scrolls horizontally. The hidden edge fades, arrows appear for pointers that can hover, and the selected tab is scrolled into view.

Tab List — With overflow menu

Open in Playground

Tabs that do not fit inline go into a TabMenu. Choosing one makes it the selected tab.

Tab List — With status dot

Open in Playground

A status dot after the label shows whether an environment is healthy.