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.
<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
| Element | Description |
|---|---|
| Left Content | Most important area; hugs content width. |
| Center-Fill Content | Stretches to fill available space. |
| Right Content | Hugs content width. |
Best practices #
| Guidance | Practice |
|---|---|
| Recommended | Leave 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. |
| Recommended | Give each Tab a unique value for selection and keyboard navigation. |
| Recommended | Use disabled for unavailable tabs; keyboard navigation skips them automatically. |
| Don't | Put too many tabs in a single strip; consider scrolling or reorganizing content when it overflows. |
| Don't | Use TabList for page-level navigation; Breadcrumbs or Link are better for wayfinding. |
Examples #
Tab List — Fill layout
With layout set to fill, the tabs share the width of the row and a divider sits under the list.
Tab List — With actions
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
A badge after the label. Error is for a count that needs attention; neutral is for an ordinary count.
Tab List — With icons
An icon before the label, so each tab is recognizable before the word is read.
Tab List — Scrolling strip
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
Tabs that do not fit inline go into a TabMenu. Choosing one makes it the selected tab.
Tab List — With status dot
A status dot after the label shows whether an environment is healthy.