Form
ToggleButton
A button that stays pressed, with its own on and off labels and icons.
WAI-ARIA tested
Import
main.ts
import { ToggleButton } from '@vitral/vue';Basic
pressed: false
Icons and labels
Sizes and states
API
Read from packages/vue/src/components/ToggleButton/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| onLabel | string | — |
| offLabel | string | — |
| onIcon | IconProp | — |
| offIcon | IconProp | — |
| size | Size | — |
| disabled | boolean | — |
| invalid | boolean | — |
| fluid | boolean | — |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| change | event: ToggleButtonChangeEvent | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| default | (props: { checked: boolean }) | Replaces the label; receives the current state. |
| icon | (props: { checked: boolean }) | — |