Components
CheckboxGroup

CheckboxGroup

The CheckboxGroup component is used to group multiple checkboxes together and manage their states collectively.

Props

NameTypeDefaultDescription
valuesT[]The list of values associated with the checkboxes in the group.
onChange(values: T[]) => voidThe callback function to execute when any checkbox in the group changes.
childrenJSX.Element | JSX.Element[]The checkboxes to include in the group.
disabledbooleanfalseDetermines whether the entire group is disabled.

Try It

import { useState } from 'react';
import { CheckboxGroup, Checkbox } from '@kloktun/uikit'

export default function CheckboxGroupExample() {

  const [values, setValues] = useState<string[]>([]);


  return (
    <div className="flex flex-col gap-4">
      
      Checked: {values.join(", ")}
      
      <CheckboxGroup values={values} onChange={setValues}>
        <Checkbox value="option1">Option 1</Checkbox>
        <Checkbox value="option2">Option 2</Checkbox>
        <Checkbox value="option3">Option 3</Checkbox>
      </CheckboxGroup>
      
    </div>
  );
}