Dice UI
Components

Checkbox Group

A group of checkboxes that allows multiple selections with support for validation and accessibility.

import * as CheckboxGroup from "@diceui/checkbox-group";
import { Check } from "lucide-react";
 
export function CheckboxGroupDemo() {
  return (
    <CheckboxGroup.Root className="peer flex flex-col gap-3.5">
      <CheckboxGroup.Label className="text-sm text-zinc-600 leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-zinc-400">
        Select your favorite tricks
      </CheckboxGroup.Label>
      <CheckboxGroup.List className="flex gap-3 data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col">
        <label className="flex w-fit select-none items-center gap-2 text-sm text-zinc-900 leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-red-500 has-data-disabled:opacity-50 dark:text-zinc-100 dark:has-data-invalid:text-red-400">
          <CheckboxGroup.Item
            value="kickflip"
            className="h-4 w-4 shrink-0 rounded-sm border border-zinc-600 shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-zinc-500 data-invalid:border-red-500 dark:border-zinc-400 dark:data-invalid:border-red-400 dark:focus-visible:ring-zinc-400 [&[data-state=checked]:not([data-invalid])]:bg-zinc-900 [&[data-state=checked]:not([data-invalid])]:text-zinc-50 dark:[&[data-state=checked]:not([data-invalid])]:bg-zinc-100 dark:[&[data-state=checked]:not([data-invalid])]:text-zinc-900 [&[data-state=checked][data-invalid]]:bg-red-500 [&[data-state=checked][data-invalid]]:text-white dark:[&[data-state=checked][data-invalid]]:bg-red-400 [&[data-state=unchecked][data-invalid]]:bg-transparent"
          >
            <CheckboxGroup.Indicator>
              <Check className="h-4 w-4" />
            </CheckboxGroup.Indicator>
          </CheckboxGroup.Item>
          Kickflip
        </label>
        <label className="flex w-fit select-none items-center gap-2 text-sm text-zinc-900 leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-red-500 has-data-disabled:opacity-50 dark:text-zinc-100 dark:has-data-invalid:text-red-400">
          <CheckboxGroup.Item
            value="heelflip"
            className="h-4 w-4 shrink-0 rounded-sm border border-zinc-600 shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-zinc-500 data-invalid:border-red-500 dark:border-zinc-400 dark:data-invalid:border-red-400 dark:focus-visible:ring-zinc-400 [&[data-state=checked]:not([data-invalid])]:bg-zinc-900 [&[data-state=checked]:not([data-invalid])]:text-zinc-50 dark:[&[data-state=checked]:not([data-invalid])]:bg-zinc-100 dark:[&[data-state=checked]:not([data-invalid])]:text-zinc-900 [&[data-state=checked][data-invalid]]:bg-red-500 [&[data-state=checked][data-invalid]]:text-white dark:[&[data-state=checked][data-invalid]]:bg-red-400 [&[data-state=unchecked][data-invalid]]:bg-transparent"
          >
            <CheckboxGroup.Indicator>
              <Check className="h-4 w-4" />
            </CheckboxGroup.Indicator>
          </CheckboxGroup.Item>
          Heelflip
        </label>
        <label className="flex w-fit select-none items-center gap-2 text-sm text-zinc-900 leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-red-500 has-data-disabled:opacity-50 dark:text-zinc-100 dark:has-data-invalid:text-red-400">
          <CheckboxGroup.Item
            value="tre-flip"
            className="h-4 w-4 shrink-0 rounded-sm border border-zinc-600 shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-zinc-500 data-invalid:border-red-500 dark:border-zinc-400 dark:data-invalid:border-red-400 dark:focus-visible:ring-zinc-400 [&[data-state=checked]:not([data-invalid])]:bg-zinc-900 [&[data-state=checked]:not([data-invalid])]:text-zinc-50 dark:[&[data-state=checked]:not([data-invalid])]:bg-zinc-100 dark:[&[data-state=checked]:not([data-invalid])]:text-zinc-900 [&[data-state=checked][data-invalid]]:bg-red-500 [&[data-state=checked][data-invalid]]:text-white dark:[&[data-state=checked][data-invalid]]:bg-red-400 [&[data-state=unchecked][data-invalid]]:bg-transparent"
          >
            <CheckboxGroup.Indicator>
              <Check className="h-4 w-4" />
            </CheckboxGroup.Indicator>
          </CheckboxGroup.Item>
          Tre Flip
        </label>
        <label className="flex w-fit select-none items-center gap-2 text-sm text-zinc-900 leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-red-500 has-data-disabled:opacity-50 dark:text-zinc-100 dark:has-data-invalid:text-red-400">
          <CheckboxGroup.Item
            value="540-flip"
            className="h-4 w-4 shrink-0 rounded-sm border border-zinc-600 shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-zinc-500 data-invalid:border-red-500 dark:border-zinc-400 dark:data-invalid:border-red-400 dark:focus-visible:ring-zinc-400 [&[data-state=checked]:not([data-invalid])]:bg-zinc-900 [&[data-state=checked]:not([data-invalid])]:text-zinc-50 dark:[&[data-state=checked]:not([data-invalid])]:bg-zinc-100 dark:[&[data-state=checked]:not([data-invalid])]:text-zinc-900 [&[data-state=checked][data-invalid]]:bg-red-500 [&[data-state=checked][data-invalid]]:text-white dark:[&[data-state=checked][data-invalid]]:bg-red-400 [&[data-state=unchecked][data-invalid]]:bg-transparent"
          >
            <CheckboxGroup.Indicator>
              <Check className="h-4 w-4" />
            </CheckboxGroup.Indicator>
          </CheckboxGroup.Item>
          540 Flip
        </label>
      </CheckboxGroup.List>
    </CheckboxGroup.Root>
  );
}

Installation

npm install @diceui/checkbox-group
pnpm add @diceui/checkbox-group
yarn add @diceui/checkbox-group
bun add @diceui/checkbox-group

Installation with shadcn/ui

CLI

npx shadcn@latest add "https://diceui.com/r/checkbox-group"
pnpm dlx shadcn@latest add "https://diceui.com/r/checkbox-group"
yarn dlx shadcn@latest add "https://diceui.com/r/checkbox-group"
bun x shadcn@latest add "https://diceui.com/r/checkbox-group"

Manual

Install the following dependencies:

npm install @diceui/checkbox-group
pnpm add @diceui/checkbox-group
yarn add @diceui/checkbox-group
bun add @diceui/checkbox-group

Copy and paste the following code into your project.

import { cn } from "@/lib/utils";
import * as CheckboxGroupPrimitive from "@diceui/checkbox-group";
import { Check } from "lucide-react";
import * as React from "react";
 
const CheckboxGroup = React.forwardRef<
  React.ComponentRef<typeof CheckboxGroupPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Root>
>(({ className, ...props }, ref) => (
  <CheckboxGroupPrimitive.Root
    data-slot="checkbox-group"
    ref={ref}
    className={cn("peer flex flex-col gap-3.5", className)}
    {...props}
  />
));
CheckboxGroup.displayName = CheckboxGroupPrimitive.Root.displayName;
 
const CheckboxGroupLabel = React.forwardRef<
  React.ComponentRef<typeof CheckboxGroupPrimitive.Label>,
  React.ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Label>
>(({ className, ...props }, ref) => (
  <CheckboxGroupPrimitive.Label
    data-slot="checkbox-group-label"
    ref={ref}
    className={cn(
      "text-foreground/70 text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
      className,
    )}
    {...props}
  />
));
CheckboxGroupLabel.displayName = CheckboxGroupPrimitive.Label.displayName;
 
const CheckboxGroupList = React.forwardRef<
  React.ComponentRef<typeof CheckboxGroupPrimitive.List>,
  React.ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.List>
>(({ className, ...props }, ref) => (
  <CheckboxGroupPrimitive.List
    data-slot="checkbox-group-list"
    ref={ref}
    className={cn(
      "flex gap-3 data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col",
      className,
    )}
    {...props}
  />
));
CheckboxGroupList.displayName = CheckboxGroupPrimitive.List.displayName;
 
const CheckboxGroupItem = React.forwardRef<
  React.ComponentRef<typeof CheckboxGroupPrimitive.Item>,
  React.ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Item>
>(({ className, children, ...props }, ref) => (
  <label className="flex w-fit select-none items-center gap-2 text-sm leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-destructive has-data-disabled:opacity-50">
    <CheckboxGroupPrimitive.Item
      data-slot="checkbox-group-item"
      ref={ref}
      className={cn(
        "h-4 w-4 shrink-0 rounded-sm border border-primary shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring data-invalid:border-destructive [&[data-state=checked]:not([data-invalid])]:bg-primary [&[data-state=checked]:not([data-invalid])]:text-primary-foreground [&[data-state=checked][data-invalid]]:bg-destructive [&[data-state=checked][data-invalid]]:text-primary-foreground [&[data-state=unchecked][data-invalid]]:bg-transparent",
        className,
      )}
      {...props}
    >
      <CheckboxGroupPrimitive.Indicator
        className="flex h-4 w-4 items-center justify-center text-current"
        asChild
      >
        <Check />
      </CheckboxGroupPrimitive.Indicator>
    </CheckboxGroupPrimitive.Item>
    {children}
  </label>
));
CheckboxGroupItem.displayName = CheckboxGroupPrimitive.Item.displayName;
 
const CheckboxGroupDescription = React.forwardRef<
  React.ComponentRef<typeof CheckboxGroupPrimitive.Description>,
  React.ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Description>
>(({ className, ...props }, ref) => (
  <CheckboxGroupPrimitive.Description
    data-slot="checkbox-group-description"
    ref={ref}
    className={cn(
      "text-[0.8rem] text-muted-foreground leading-none data-invalid:text-destructive",
      className,
    )}
    {...props}
  />
));
CheckboxGroupDescription.displayName =
  CheckboxGroupPrimitive.Description.displayName;
 
const CheckboxGroupMessage = React.forwardRef<
  React.ComponentRef<typeof CheckboxGroupPrimitive.Message>,
  React.ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Message>
>(({ className, ...props }, ref) => (
  <CheckboxGroupPrimitive.Message
    data-slot="checkbox-group-message"
    ref={ref}
    className={cn(
      "text-[0.8rem] text-muted-foreground leading-none data-invalid:text-destructive",
      className,
    )}
    {...props}
  />
));
CheckboxGroupMessage.displayName = CheckboxGroupPrimitive.Message.displayName;
 
export {
  CheckboxGroup,
  CheckboxGroupLabel,
  CheckboxGroupList,
  CheckboxGroupItem,
  CheckboxGroupDescription,
  CheckboxGroupMessage,
};

Layout

Import the parts, and compose them together.

import * as CheckboxGroup from "@diceui/checkbox-group";

<CheckboxGroup.Root>
  <CheckboxGroup.Label />
  <CheckboxGroup.List>
    <CheckboxGroup.Item>
      <CheckboxGroup.Indicator />
    </CheckboxGroup.Item>
  </CheckboxGroup.List>
  <CheckboxGroup.Description>
</CheckboxGroup.Root>

Animated Checkbox

Update tailwind.config.ts to include the following animation:

export default {
  theme: {
    extend: {
      keyframes: {
        "stroke-dashoffset": {
          "0%": { strokeDashoffset: "100%" },
          "100%": { strokeDashoffset: "0" },
        },
      },
      animation: {
        "stroke-dashoffset": "stroke-dashoffset 0.2s linear forwards",
      },
    },
  },
}

Copy and paste the CheckboxGroup.Indicator block from the following example into your project.

import * as CheckboxGroup from "@diceui/checkbox-group";
 
export function CheckboxGroupDemo() {
  return (
    <CheckboxGroup.Root className="peer flex flex-col gap-3.5">
      <label className="flex w-fit select-none items-center gap-2 text-sm text-zinc-900 leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-red-500 has-data-disabled:opacity-50 dark:text-zinc-100 dark:has-data-invalid:text-red-400">
        <CheckboxGroup.Item
          value="kickflip"
          className="h-4 w-4 shrink-0 rounded-sm border border-zinc-600 shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-zinc-500 data-invalid:border-red-500 dark:border-zinc-400 dark:data-invalid:border-red-400 dark:focus-visible:ring-zinc-400 [&[data-state=checked]:not([data-invalid])]:bg-zinc-900 [&[data-state=checked]:not([data-invalid])]:text-zinc-50 dark:[&[data-state=checked]:not([data-invalid])]:bg-zinc-100 dark:[&[data-state=checked]:not([data-invalid])]:text-zinc-900 [&[data-state=checked][data-invalid]]:bg-red-500 [&[data-state=checked][data-invalid]]:text-white dark:[&[data-state=checked][data-invalid]]:bg-red-400 [&[data-state=unchecked][data-invalid]]:bg-transparent"
        >
          <CheckboxGroup.Indicator
            className="h-4 w-4 animate-stroke-dashoffset [stroke-dasharray:100%_100%] motion-reduce:animate-none"
            asChild
          >
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="28"
              height="28"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              strokeWidth="2"
              strokeLinecap="round"
              strokeLinejoin="round"
            >
              <path d="M4 12 9 17L20 6" />
            </svg>
          </CheckboxGroup.Indicator>
        </CheckboxGroup.Item>
        Kickflip
      </label>
      <label className="flex w-fit select-none items-center gap-2 text-sm text-zinc-900 leading-none has-data-disabled:cursor-not-allowed has-data-invalid:text-red-500 has-data-disabled:opacity-50 dark:text-zinc-100 dark:has-data-invalid:text-red-400">
        <CheckboxGroup.Item
          value="heelflip"
          className="h-4 w-4 shrink-0 rounded-sm border border-zinc-600 shadow-sm focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-zinc-500 data-invalid:border-red-500 dark:border-zinc-400 dark:data-invalid:border-red-400 dark:focus-visible:ring-zinc-400 [&[data-state=checked]:not([data-invalid])]:bg-zinc-900 [&[data-state=checked]:not([data-invalid])]:text-zinc-50 dark:[&[data-state=checked]:not([data-invalid])]:bg-zinc-100 dark:[&[data-state=checked]:not([data-invalid])]:text-zinc-900 [&[data-state=checked][data-invalid]]:bg-red-500 [&[data-state=checked][data-invalid]]:text-white dark:[&[data-state=checked][data-invalid]]:bg-red-400 [&[data-state=unchecked][data-invalid]]:bg-transparent"
        >
          <CheckboxGroup.Indicator
            className="h-4 w-4 animate-stroke-dashoffset [stroke-dasharray:100%_100%] motion-reduce:animate-none"
            asChild
          >
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="28"
              height="28"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              strokeWidth="2"
              strokeLinecap="round"
              strokeLinejoin="round"
            >
              <path d="M4 12 9 17L20 6" />
            </svg>
          </CheckboxGroup.Indicator>
        </CheckboxGroup.Item>
        Heelflip
      </label>
    </CheckboxGroup.Root>
  );
}

Examples

Horizontal Orientation

Select grab tricks
import {
  CheckboxGroup,
  CheckboxGroupDescription,
  CheckboxGroupItem,
  CheckboxGroupLabel,
  CheckboxGroupList,
} from "@/components/ui/checkbox-group";
 
export function CheckboxGroupHorizontalDemo() {
  return (
    <CheckboxGroup orientation="horizontal">
      <CheckboxGroupLabel>Tricks</CheckboxGroupLabel>
      <CheckboxGroupList>
        <CheckboxGroupItem value="indy">Indy</CheckboxGroupItem>
        <CheckboxGroupItem value="stalefish">Stalefish</CheckboxGroupItem>
        <CheckboxGroupItem value="pizza-guy">Pizza Guy</CheckboxGroupItem>
        <CheckboxGroupItem value="fs-540">FS 540</CheckboxGroupItem>
      </CheckboxGroupList>
      <CheckboxGroupDescription>Select grab tricks</CheckboxGroupDescription>
    </CheckboxGroup>
  );
}

With Validation

Validate the group with onValidate or required prop. Can be used for native form validation.

Select grab tricks
"use client";
 
import {
  CheckboxGroup,
  CheckboxGroupDescription,
  CheckboxGroupItem,
  CheckboxGroupLabel,
  CheckboxGroupList,
  CheckboxGroupMessage,
} from "@/components/ui/checkbox-group";
import * as React from "react";
 
export function CheckboxGroupValidationDemo() {
  const [tricks, setTricks] = React.useState<string[]>(["stalefish", "fs-540"]);
 
  return (
    <CheckboxGroup
      value={tricks}
      onValueChange={setTricks}
      onValidate={(value) =>
        value.includes("indy") ? "Indy is not allowed" : null
      }
    >
      <CheckboxGroupLabel>Tricks</CheckboxGroupLabel>
      <CheckboxGroupList>
        <CheckboxGroupItem value="indy">Indy</CheckboxGroupItem>
        <CheckboxGroupItem value="stalefish">Stalefish</CheckboxGroupItem>
        <CheckboxGroupItem value="fs-540">FS 540</CheckboxGroupItem>
      </CheckboxGroupList>
      <CheckboxGroupDescription hideOnError>
        Select grab tricks
      </CheckboxGroupDescription>
      <CheckboxGroupMessage />
    </CheckboxGroup>
  );
}

Multi Selection

Hold down the Shift key to select and deselect multiple checkboxes at once.

Hold Shift and click to select multiple items
"use client";
 
import {
  CheckboxGroup,
  CheckboxGroupDescription,
  CheckboxGroupItem,
  CheckboxGroupLabel,
  CheckboxGroupList,
} from "@/components/ui/checkbox-group";
import * as React from "react";
 
const tricks = [
  { label: "Kickflip", value: "kickflip" },
  { label: "Heelflip", value: "heelflip" },
  { label: "Tre Flip", value: "tre-flip" },
  { label: "Pizza Guy", value: "pizza-guy" },
  { label: "FS 540", value: "fs-540" },
  { label: "The 900", value: "the-900" },
];
 
export function CheckboxGroupMultiSelectionDemo() {
  const { value, onValueChange, onShiftKeyDown } = useShiftMultiSelect({
    items: tricks,
    getItemValue: (item) => item.value,
  });
 
  return (
    <CheckboxGroup value={value} onValueChange={onValueChange}>
      <CheckboxGroupLabel>Tricks</CheckboxGroupLabel>
      <CheckboxGroupDescription>
        Hold Shift and click to select multiple items
      </CheckboxGroupDescription>
      <CheckboxGroupList
        className="mt-1"
        onKeyDown={onShiftKeyDown}
        onKeyUp={onShiftKeyDown}
      >
        {tricks.map((trick) => (
          <CheckboxGroupItem key={trick.value} value={trick.value}>
            {trick.label}
          </CheckboxGroupItem>
        ))}
      </CheckboxGroupList>
    </CheckboxGroup>
  );
}
 
interface UseShiftMultiSelectProps<T> {
  /** The items for selection. */
  items: T[];
 
  /** The value of the item. */
  getItemValue: (item: T) => string;
}
 
function useShiftMultiSelect<T>({
  items,
  getItemValue,
}: UseShiftMultiSelectProps<T>) {
  const [selectedValues, setSelectedValues] = React.useState<string[]>([]);
  const [lastSelected, setLastSelected] = React.useState<number | null>(null);
  const isShiftPressedRef = React.useRef(false);
 
  const onShiftKeyDown = React.useCallback(
    (event: React.KeyboardEvent<HTMLElement>) => {
      if (event.key === "Shift") {
        isShiftPressedRef.current = event.type === "keydown";
      }
    },
    [],
  );
 
  const onValueChange = React.useCallback(
    (newValue: string[]) => {
      // Handle single selection
      if (!isShiftPressedRef.current || lastSelected === null) {
        setSelectedValues(newValue);
        const clickedValue =
          newValue.find((v) => !selectedValues.includes(v)) ??
          selectedValues.find((v) => !newValue.includes(v));
        if (clickedValue) {
          const newIndex = items.findIndex(
            (item) => getItemValue(item) === clickedValue,
          );
          if (newIndex !== -1) {
            setLastSelected(newIndex);
          }
        }
        return;
      }
 
      // Find the currently clicked item
      const clickedValue =
        newValue.find((v) => !selectedValues.includes(v)) ??
        selectedValues.find((v) => !newValue.includes(v));
      if (!clickedValue) return;
 
      const currentIndex = items.findIndex(
        (item) => getItemValue(item) === clickedValue,
      );
      if (currentIndex === -1) return;
 
      // Handle shift-click selection
      const start = Math.min(lastSelected, currentIndex);
      const end = Math.max(lastSelected, currentIndex);
      const rangeValues = items
        .slice(start, end + 1)
        .map((item) => getItemValue(item));
 
      const newSelectedValues = new Set(selectedValues);
      const currentItem = items[currentIndex];
      const isSelecting =
        currentItem && !selectedValues.includes(getItemValue(currentItem));
 
      for (const value of rangeValues) {
        if (isSelecting) {
          newSelectedValues.add(value);
        } else {
          newSelectedValues.delete(value);
        }
      }
 
      setSelectedValues(Array.from(newSelectedValues));
      setLastSelected(currentIndex);
    },
    [lastSelected, selectedValues, items, getItemValue],
  );
 
  return {
    value: selectedValues,
    onValueChange,
    onShiftKeyDown,
  };
}

API Reference

Root

Container for the checkbox group.

PropTypeDefault
orientation?
"horizontal" | "vertical"
"vertical"
name?
string
-
required?
boolean
false
readOnly?
boolean
false
invalid?
boolean
-
disabled?
boolean
-
onValidate?
((value: string[]) => string | true | string[] | null | undefined)
-
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLDivElement>
-
onResize?
ReactEventHandler<HTMLDivElement>
-
onValueChange?
((value: string[]) => void)
-
value?
string[]
-
defaultValue?
string[]
-
Data AttributeValue
[data-invalid]Present when invalid.
[data-disabled]Present when disabled.
[data-orientation]"vertical" | "horizontal"

Label

Label for the checkbox group.

PropTypeDefault
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLLabelElement>
-
onResize?
ReactEventHandler<HTMLLabelElement>
-
Data AttributeValue
[data-disabled]Present when disabled.

List

Container for checkbox items.

PropTypeDefault
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLDivElement>
-
onResize?
ReactEventHandler<HTMLDivElement>
-
Data AttributeValue
[data-orientation]"vertical" | "horizontal"
[data-invalid]Present when invalid.

Item

Individual checkbox item.

PropTypeDefault
required?
boolean
-
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLButtonElement>
-
onResize?
ReactEventHandler<HTMLButtonElement>
-
Data AttributeValue
[data-state]"checked" | "unchecked"
[data-disabled]Present when disabled.
[data-invalid]Present when invalid.
[data-orientation]"vertical" | "horizontal"

Indicator

Visual indicator for the checkbox state.

PropTypeDefault
forceMount?
boolean
-
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLSpanElement>
-
onResize?
ReactEventHandler<HTMLSpanElement>
-
Data AttributeValue
[data-state]"checked" | "unchecked"
[data-disabled]Present when disabled.

Description

Optional description text for the checkbox group.

PropTypeDefault
hideOnError?
boolean
false
announce?
boolean
false
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLDivElement>
-
onResize?
ReactEventHandler<HTMLDivElement>
-
Data AttributeValue
[data-disabled]Present when disabled.
[data-invalid]Present when invalid.

Message

Error or validation message for the checkbox group.

PropTypeDefault
announce?
boolean
false
asChild?
boolean
-
onResizeCapture?
ReactEventHandler<HTMLDivElement>
-
onResize?
ReactEventHandler<HTMLDivElement>
-
Data AttributeValue
[data-disabled]Present when disabled.
[data-invalid]Present when invalid.

Accessibility

Keyboard Interactions

KeyDescription
SpaceToggles checkbox item.