Skip to content

Toggle

SToggle is a two-state toggle button (pressed/unpressed) built on Reka UI: it carries the button role with aria-pressed and data-state. It is used on its own (for example, "bold" in an editor) or inside SToggleGroup — then the group manages the state.

Single toggle

Sizes

Group (SToggleGroup)

Groups related toggles. type="single" keeps one item active, type="multiple" allows any subset. Items are set with the options prop or with SToggles placed in the slot (each needs a value).

Multiple selection

Color

The color prop sets the color of the on state from the palette.

API

SToggle

Props

NameTypeDefaultDescription
colorstringundefinedColor of the on state: a name from the palette (primary/teal/teal-10).
valuestringundefinedItem value inside SToggleGroup (unique within the group). Not set on a standalone toggle.
size"md" | "sm" | "lg""md"Size: sm, md or lg.
squarebooleanundefinedSquare corners: removes the border radius (rounded by default).
disabledbooleanfalseDisables the toggle.
aria-labelstringundefinedAccessible name: set it when the toggle content is only an icon.
model-valuebooleanfalsePressed state of a standalone toggle. Two-way binding via v-model (not used inside SToggleGroup — the group manages the state).

Events

NameSignatureDescription
update:modelValue(value: boolean) => voidEmitted when modelValue changes. Used for two-way binding (v-model).

Slots

NameDescription
defaultToggle content: text and/or an icon.

SToggleGroup

Props

NameTypeDefaultDescription
type"single" | "multiple""single"Selection mode: single allows one active item, multiple any subset.
size"md" | "sm" | "lg""md"Size of the toggles in the group.
options{ label?: string; value: string; disabled?: boolean }[]undefinedGroup items (an alternative to the default slot with hand-written SToggles).
disabledbooleanundefinedDisables the whole group and all its items.
aria-labelstringundefinedAccessible name of the group (aria-label).
model-valuestring | string[]undefinedSelected value (single) or array of values (multiple). Two-way bound via v-model.

Events

NameSignatureDescription
update:modelValue( value: | string | string[] | undefined ) => voidEmitted when modelValue changes. Used for two-way binding (v-model).

Slots

NameDescription
defaultCustom set of SToggle (instead of the options prop); give each one a value.