Introducing PrimeReact v11-alpha 🎉Discover Now
styledForm

ToggleButtonGroup

ToggleButtonGroup component is used to create a group of toggle buttons.

preview

Usage#

import { ToggleButtonGroup } from '@primereact/ui/togglebuttongroup';
<ToggleButtonGroup></ToggleButtonGroup>

Examples#

Basic#

A group of toggle buttons where one or more can be active at a time.

basic-demo

Controlled#

Use value and onValueChange properties to control the state of the ToggleButton.Group.

controlled-demo

Multiple#

ToggleButton.Group allows selecting only one item by default and setting multiple option enables choosing more than one item. In multiple case, model property should be an array.

multiple-demo

Sizes#

ToggleButton.Group provides small and large sizes as alternatives to the base by using the size property.

sizes-demo

Invalid#

Invalid state is displayed using the invalid prop to indicate a failed validation. This style is useful when integrating with form validation libraries.

invalid-demo

Disabled#

When disabled is present, the element cannot be edited and focused entirely. Certain options can also be disabled using their disabled properties.

disabled-demo

API#

Sub-Components#

See Primitive API for ToggleButtonRoot, ToggleButtonIndicator, ToggleButtonGroup component documentation.

Hooks#

See Headless API for useToggleButton and useToggleButtonGroup hook documentation.

Accessibility#

See ToggleButton Primitive for WAI-ARIA compliance details and keyboard support.