Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

ToggleGroup

Pass items as { value, label, disabled? }. The machine manages roving focus, arrow keys, and pressed values.

Use the discriminated API for type-safe values: type="single" uses a string, while type="multiple" uses a string array. The former array-only API remains available for compatibility. Give a single-select group an accessible name through rootProps.

import { ToggleGroup } from '@manti-ui/react';

const items = [
  { value: 'left', label: 'Left' },
  { value: 'center', label: 'Center' },
  { value: 'right', label: 'Right' },
];

export default function ToggleGroupBasic() {
  return <ToggleGroup items={items} variant="primary" defaultValue={['center']} />;
}

Multiple selection

Sizes

API

PropTypeDefaultDescription
itemsToggleGroupItem[]The options — each `{ value, label, disabled? }`.
size'sm' | 'md' | 'lg''md'Control size.
variantMantiVariant'primary'Active variant for pressed items.
type'single' | 'multiple'Selection mode. Single mode uses scalar string values; multiple mode uses arrays.
valuestring | string[]Controlled pressed values.
defaultValuestring | string[]Initial pressed values for uncontrolled usage.
onValueChange(value: string | string[]) => voidCalled whenever the pressed set changes.
rootPropsHTMLAttributes<HTMLDivElement>ARIA, data, style, class, and native props for the group root.
getItemProps(item: ToggleGroupItem) => ButtonHTMLAttributesProps merged onto every item button.
orientation'horizontal' | 'vertical''horizontal'Layout axis and arrow-key direction.
disabledbooleanDisable the whole group.

Styling

Anatomy

PartSelectorDescription
root[data-scope="toggle-group"][data-part="root"]The wrapper that owns size, variant, and orientation.
item[data-scope="toggle-group"][data-part="item"]A single toggle button.

Tokens

TokenControls
--manti-toggle-group-heightheight
--manti-toggle-group-padding-xpadding x
--manti-toggle-group-radiusradius

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub