Kaapi UI
← Back to Design System

ButtonGroup & ButtonToggleGroup

  • Use the ButtonGroup component when you want to group buttons that perform an action.
  • Use the ButtonToggleGroup component when you want to group buttons that toggle a state.

ButtonGroup


<ButtonGroup 
    items={[
        { label: "Archive", leftIcon: Archive },
        { label: "Edit", leftIcon: Edit03 },
        { label: "Delete", leftIcon: Trash01 },
    ]} 
/>

Single Selection

<ButtonToggleGroup value={value} onValueChange={setValue} items={items} />

Multiple Selection

<ButtonToggleGroup type="multiple" value={values} onValueChange={setValues} items={items} />

Sizes

<ButtonToggleGroup size="sm" items={defaultItems} />
<ButtonToggleGroup size="md" items={defaultItems} />
<ButtonToggleGroup size="lg" items={defaultItems} />

Disabled

<ButtonToggleGroup value="" disabled items={[
        { value: "today", label: "Today" },
        { value: "tomorrow", label: "Tomorrow" },
        { value: "thisweek", label: "This week" },
    ]/>

API Reference

The ButtonToggleGroup component is built on Radix UI's ToggleGroup primitive. It inherits all of its props and behaviors.

PropsTypeDefaultDescription
valuestring | string[]-Selected value(s) for the ButtonToggleGroup.
onValueChange(value: string | string[]) => void-Callback when selection changes.
type?"single" | "multiple""single"Single or multiple selection mode.
size?"sm" | "md" | "lg""md"Button size.
items?ButtonToggleGroupItemProps[]-Array of items to render within the group.
disabled?booleanfalseDisable the button or the entire group.
className?string-additional class for the entire group.

ButtonToggleGroupItem

The ButtonToggleGroupItem component inherits all of its props and behaviors from Radix UI's ToggleGroupItem primitive.

PropTypeDescription
valuestringThe value of the toggle item.
leftIcon?React.ComponentType<{ className?: string }> | React.ReactNodeIcon to be rendered before the label.
rightIcon?React.ComponentType<{ className?: string }> | React.ReactNodeIcon to be rendered after the label.
label?React.ReactNodeThe content of the button.
disabled?booleanDisable the individual button item.
className?stringadditional class for the item.