Skip to content

Segmented

A set of mutually exclusive options with a sliding background indicator. Useful for view switching or filtering.

Basic Usage

vue
<script setup>
import { ref } from 'vue'

const value = ref('article')
const options = [
  { label: 'Auto', value: 'auto' },
  { label: 'Article', value: 'article' },
  { label: 'Outline', value: 'outline' }
]
</script>

<ASegmented v-model="value" :options="options" />

Size

vue
<ASegmented :options="options" size="sm" />
<ASegmented :options="options" size="md" />

Disabled

vue
<ASegmented v-model="value" :options="options" disabled />

API

Props

NameTypeDefaultDescription
modelValuestring | number''Currently selected value
optionsSegmentedOption[][]Options list
disabledbooleanfalseDisable entire component
size'sm' | 'md''md'Size

SegmentedOption

NameTypeDefaultDescription
labelstringDisplay text
valuestring | numberOption value
disabledbooleanfalseDisable this option

Emits

NameParametersDescription
update:modelValuestring | numberTriggered when value changes
changestring | numberTriggered on user confirmation

Interaction

  • White indicator block transitions left + width using --ease-spring spring curve
  • Keyboard: left/right arrows to switch, Home / End to jump to first/last
  • Selected item text is --color-neutral-950, unselected is --color-neutral-500

MIT License