KKiotaPay UI
Browse documentation

Checkbox Group

A whole group of checkboxes, not a single box — value is always an array. Options wrap into rows and an inline filter narrows long lists.

Installation

pnpm dlx shadcn@latest add https://kiotapay-ui-staging.staging.kiotapay.com/r/checkbox.json

Installs components/custom/checkbox.tsx, the shadcn checkbox primitive it renders each option with, and form-field. The single primitive stays available at @/components/ui/checkbox.

Usage

'use client'

import { Checkbox } from '@/components/custom/checkbox'

export function PermissionsField({ permissions, value, onChange }) {
  return (
    <Checkbox
      label="Role permissions"
      required
      data={permissions}
      value={value}
      onChange={onChange}
      valueKey="code"
      labelKey="name"
    />
  )
}

Props

PropTypeDefaultDescription
dataFieldOption[][]Options. Any object shape.
valueany[][]Selected values.
onChange(value: any[]) => void—Receives the whole next array.
valueKeystring'value'Property read for each stored value.
labelKeystring | string[]'label'Property or properties read for each label.
labelstring—Required. Labels the group.
placeholderstring'No options available.'Shown when the list is empty or filtered to nothing.
searchPlaceholderstring'Search...'Pass '' to hide the filter entirely.
disabledbooleanfalseBlocks every option.
errorbooleanfalseSwitches the group border to the danger ramp.
errorMessageReactNode—Shown only while error is true.

Behaviour notes

Options wrap rather than stack. Permission and tag labels are short, and a single-file column turns twenty of them into a scroll for no gain.

Filtering never changes the selection. Options hidden by the filter stay selected — the filter is a view over the list, not an edit to it.

The group is announced as a group. role="group" plus aria-labelledby means a screen reader reads the heading once and then each option, instead of repeating the heading per box.