Search documentation

Search the documentation and open a page.

A set of two-state buttons that can be toggled on or off.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/toggle-group

Composition

ToggleGroup └── ToggleGroupItem

Examples

Custom

Loading...

Default

Loading...

Disabled

Loading...

Orientation

Loading...

Sizes

Loading...

Spacing

Loading...

Variants

Loading...

API Reference

ToggleGroup

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
disabledboolean | undefinedfalseDisables interaction with the component.
valuestring[] | undefined—Current value when the component is controlled.
defaultValuestring[] | undefined—Initial value when the component is uncontrolled.
onValueChange((details: ValueChangeDetails) => void) | undefined—Runs when value changes.
loopFocusboolean | undefined—Configures loop focus.
rovingFocusboolean | undefined—Configures roving focus.
orientationOrientation | undefined"horizontal"Sets the component orientation and keyboard navigation axis.
multipleboolean | undefinedfalseAllows more than one value to be selected or expanded.
deselectableboolean | undefined—Configures deselectable.

Context, Hooks, and Types

ExportAPI
ToggleGroupArkContextRender-prop component that exposes component state and actions.
ToggleGroupRootProviderProvides an externally created API to the component tree.
useToggleGroupCreates or accesses the component API.
useToggleGroupContextReturns the nearest component API.
ToggleGroupValueChangeDetailsType for the details object passed to the matching change callback.