Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

ToggleGroup

A segmented control for a short, always-visible set of choices.

import { ToggleGroup } from '@loidolt/theme-svelte';

Example

Tool: select · Overlays: grid

Notes

  • Single mode is a radio group in behaviour and in markup; multiple mode is a row of pressed buttons.
  • Reach for Select instead once the options stop being worth showing at all times.

Props

Generated from the component source, so it cannot drift from the implementation.

ToggleGroup props
PropTypeDefaultNotes
options required Option<T>[]—
children Snippet<[Option<T>]>—Renders an option's contents — an icon, say — in place of its plain label.
class string—
disabled booleanfalse
id string—Narrowed from the DOM attribute: the Bits root this spreads onto rejects null.
itemClass string—
label string—Accessible name of the group.
multiple booleanfalseLets more than one option be pressed at once. value is then an array.
onValueChange (value: T | T[]) => void—
orientation Orientation'horizontal'
ref bindableHTMLDivElement | nullnull
size ControlSize'md'
value bindableT | T[]—Pressed option, or options when multiple. Bindable.

Plus the attributes of Omit<HTMLAttributes<HTMLDivElement>, 'children'>, forwarded to the root element.