Install
Run these in the app, after shadcn-vue init and the Beehexa theme (Button › Code):
npx shadcn-vue@latest add https://beehexa.design/r/segmented-control.json
Use
<script setup lang="ts">
import { ref } from 'vue'
import { SegmentedControl, SegmentedControlItem } from '@/components/ui/segmented-control'
const period = ref('week')
</script>
<template>
<div class="flex flex-col items-start gap-(--bh-space-100)">
<SegmentedControl v-model="period" aria-label="Period">
<SegmentedControlItem value="day">Day</SegmentedControlItem>
<SegmentedControlItem value="week">Week</SegmentedControlItem>
<SegmentedControlItem value="month">Month</SegmentedControlItem>
</SegmentedControl>
<p class="m-0 text-(--bh-color-text-subtle)">Showing syncs by {{ period }}</p>
</div>
</template>
Props
| Prop | Values | Notes |
|---|---|---|
v-model (modelValue) |
string | The selected value |
aria-label |
string | Names the choice, such as “Period” |
SegmentedControlItem value |
string | Required |
disabled |
boolean | On the control or one item |
Built on
Wraps the reka-ui RadioGroup: it is a radio group that looks like segments.