Toggle Group

Toggles that merge into one capsule of glass.

Installation#

pnpmnpmyarnbun
$ pnpm dlx shadcn@latest add @liquikit/toggle-group

Needs 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

PropTypeDefault
theme"light" | "dark"

Light or dark glass. Falls back to the nearest GlassThemeProvider, then light.

—
lensPartial<LensProfile>

Overrides for the lens profile, such as thickness, bevel, ior and magnification.

—
liquidnumber

How far the glass squashes and stretches as it moves. 0 keeps it rigid.

—
options*ReadonlyArray<string | Segment>

The toggles, as strings or { value, label, disabled } objects.

—
valuestring[]

The pressed toggles, when you control them.

—
defaultValuestring[]

The toggles pressed to begin with.

[]
onValueChange(value: string[], eventDetails?: BaseToggleGroup.ChangeEventDetails) => void

Called with the new value when the user changes it.

—
heightnumber

Height of the group, in pixels.

—

Also takes every prop of Base UI's toggle group, plus className and style.