Officina UI
Components

CheckboxGroup

Controlled multi-select of checkboxes backed by an array of selected values.

CheckboxGroup renders a set of options as checkboxes and tracks which are selected as a string[]. It is controlled — value is the array of selected values and onChange fires with the next array whenever a box toggles. Stack them vertically or horizontally with orientation, disable the whole set with disabled, and flag validation state with invalid.

Example

Preview

Account + billing alerts

Critical alerts only

import { CheckboxGroup } from '@officina/ui';
import { useState } from 'react';

function Example() {
  const [value, setValue] = useState<string[]>(['email']);
  return (
    <CheckboxGroup
      value={value}
      onChange={setValue}
      options={[
        { value: 'email', label: 'Email' },
        { value: 'sms', label: 'SMS' },
        { value: 'push', label: 'Push' },
      ]}
    />
  );
}

API

PropTypeDefaultDescription
onChange*(value: string[]) => void—Called with the next array of selected values when any box toggles.
options*CheckboxGroupOption[]—Selectable options rendered as checkboxes.
value*string[]—Currently selected option values (controlled).
disabledboolean—Disables every checkbox in the group.
invalidboolean—Marks the group invalid for validation styling (sets `data-invalid`).
namestring—Shared form field name applied to each checkbox.
orientationenumverticalStacking direction of the checkboxes. Defaults to `'vertical'`.

On this page