PeakUI

CheckboxGroup

Group of related checkboxes

Usage

import {Checkbox, CheckboxGroup} from "@peakui/react";

Examples

Indeterminate Select All

Disabled

Customization

Tailwind CSS

<CheckboxGroup className="gap-2">
  <Label>Label</Label>
  <Checkbox value="a">
    <Checkbox.Content>
      <Checkbox.Control>
        <Checkbox.Indicator />
      </Checkbox.Control>
      Option A
    </Checkbox.Content>
  </Checkbox>
</CheckboxGroup>

Global CSS

.checkbox-group {
  gap: 0.5rem;
}

Styling Reference

CSS Classes

ClassDescription
.checkbox-groupThe group wrapper element
.checkbox-group--primary, .checkbox-group--secondaryVariant modifiers

Slots

SlotDescription
[data-slot="checkbox-group"]The group wrapper element

Interactive States

The group itself renders no interactive states; the styles apply to its [data-slot="checkbox"] children.

API Reference

CheckboxGroup.Root

PropTypeDefaultDescription
variant"primary" | "secondary""primary"Visual variant inherited by child checkboxes
valuestring[]-Controlled selected values
defaultValuestring[]-Uncontrolled initial values
isDisabledboolean-Disables every child checkbox
isReadOnlyboolean-Makes every child checkbox read-only
namestring-The name used when submitting an HTML form
onChange(value: string[]) => void-Called when the selection changes
renderDOMRenderFunction<'div', CheckboxGroupRenderProps>-Replaces the rendered element
...restEvery React Aria CheckboxGroup attribute is accepted

Render Props

children and className accept a function receiving the group render props (isDisabled, isReadOnly, isRequired, isInvalid, state).

On this page