Components / Toggle group

Actions

Toggle group

stable

A set of pressable toggles for switching views or formatting text.

since v2.41.4 kB gzip

Preview

View: grid · Marks: bold

Installation

npx @strata/cli add toggle-group

Usage

import { ToggleGroup, Toggle } from "@/components/strata";

<ToggleGroup defaultSelectedKeys={["grid"]}>
  <Toggle id="grid">Grid</Toggle>
  <Toggle id="list">List</Toggle>
</ToggleGroup>

Props

PropTypeDefault
selectionMode

How many items can be pressed at once.

"single" | "multiple""single"
selectedKeys

Controlled pressed items.

Iterable<Key>—
variant

Group appearance.

"attached" | "segmented" | "spaced""attached"
isDisabled

Prevents interaction and dims the control.

booleanfalse

Accessibility

Was this page helpful?

Documented since v2.4 · components/toggle-group.mdx