Toggle Group
Toggles that merge into one capsule of glass.
Installation#
pnpmnpmyarnbun
$ pnpm dlx shadcn@latest add @liquikit/toggle-groupNeeds the @liquikit registry in your components.json. Set it up once.
Usage#
import { ToggleGroup } from "@/components/liquikit/toggle-group"<ToggleGroup
options={["Left", "Center", "Right"]}
defaultValue={["Left"]}
aria-label="Alignment"
/>Examples#
Multiple#
Pass multiple to let more than one toggle stay pressed.
API Reference#
ToggleGroup
| Prop | Type | Default |
|---|---|---|
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
lens | Partial<LensProfile>Overrides for the lens profile, such as | — |
liquid | numberHow far the glass squashes and stretches as it moves. | — |
options* | ReadonlyArray<string | Segment>The toggles, as strings or | — |
value | string[]The pressed toggles, when you control them. | — |
defaultValue | string[]The toggles pressed to begin with. | [] |
onValueChange | (value: string[], eventDetails?: BaseToggleGroup.ChangeEventDetails) => voidCalled with the new value when the user changes it. | — |
height | numberHeight of the group, in pixels. | — |
Also takes every prop of Base UI's toggle group, plus className and style.