Form
SelectButton
A segmented control for one choice, as a radio group, or several, as toggle buttons.
WAI-ARIA tested
Import
main.ts
import { SelectButton } from '@vitral/vue';Single
value: Week
Icons
value: left
Multiple
value: ["bold"]
Sizes and states
API
Read from packages/vue/src/components/SelectButton/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| options | any[] | — |
| optionLabel | string | Field (dotted path) holding an option's text. Without it, options are shown as they are. |
| optionValue | string | Field holding the value v-model receives. Without it, the whole option is the value. |
| optionDisabled | string | — |
| optionIcon | string | Field holding an option's icon. |
| multiple | boolean | Several options at once; v-model is then an array. |
| allowEmpty | boolean | Let the pressed option be pressed again to clear it. Defaults to true. |
| dataKey | string | Compare object values by this field instead of structurally. |
| size | Size | — |
| disabled | boolean | — |
| invalid | boolean | — |
| fluid | boolean | — |
| label | string | Names the group; without it, name it with `aria-label` or `aria-labelledby`. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| change | event: SelectButtonChangeEvent | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| option | (props: { option: unknown; index: number; checked: boolean }) | — |
| icon | (props: { option: unknown; icon?: IconProp }) | — |