Skip to content

Segmented ​

State belongs to the parent. Compose this component with the props and slots below.

Preview ​

Open in the playground

Usage ​

SegmentedExample.vueVue / TS
<script setup lang="ts">
import { ref } from 'vue'
import { FzSegmented } from '@chrisdalbano/forza-ui'
import type { ForzaOption } from '@chrisdalbano/forza-ui'
const view = ref<string>('grid')
const options: ForzaOption[] = [
  { value: 'grid', label: 'Grid' },
  { value: 'list', label: 'List' },
]
</script>

<template>
  <FzSegmented v-model="view" label="Layout" :options="options" />
</template>
TypeScript exampleSource you can use.

Import the shared stylesheet once and wrap your app in .fz-theme. See installation.

Props ​

NameTypeRequiredDefault
labelstringYesNone
optionsreadonly { value: string; label: string; }[]YesNone
modelValuestringYesNone

Events and state ​

v-model: string

  • update:modelValue: [value: string]

Slots ​

none

Add from source ​

sh
forza add segmented

Set up the CLI first. Generated API tables come from the Vue source, using Vue Language Tools.

Released under the MIT License. Independent work.