• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

CheckboxList

react-hook-form-bound multi-select field: a labeled group of checkboxes backed by an array of selected option ids. Wraps the @uxf/ui/checkbox-list primitive and manages its value, isInvalid, and helperText from form state.

When to use

Use @uxf/form/checkbox-list to let the user pick multiple options from a fixed list inside a @uxf/form form — it registers the field with react-hook-form via control/name. For a standalone, manually-controlled list (outside a form), use the @uxf/ui/checkbox-list twin directly. For a single boolean, use @uxf/form/checkbox-input.

Usage

import { CheckboxList } from "@uxf/form/checkbox-list";
import { Form } from "@uxf/form/form";
import { useForm } from "react-hook-form";

interface FormData {
    options: string[];
}

const OPTIONS = [
    { id: "1", label: "Option 1" },
    { id: "2", label: "Option 2" },
    { id: "3", label: "Option 3" },
];

function Example() {
    const formApi = useForm<FormData>({ defaultValues: { options: [] } });

    return (
        <Form formApi={formApi} id="example" onSubmit={(values) => console.log(values)}>
            <CheckboxList control={formApi.control} isRequired label="Pick options" name="options" options={OPTIONS} />
        </Form>
    );
}

Value is the array of selected option ids (ValueId[] | null, where ValueId is string | number).

Props

CheckboxListProps<FormData> = ControlProps<FormData> + the visual props of the @uxf/ui/checkbox-list twin (minus the ones this field manages: isInvalid, name, onChange, value) + the field props below.

Prop Type Default Description
control Control<FormData> — Required. The control from useForm.
name FieldPath<FormData> — Required. Field path in the form values.
options CheckboxListOption[] — Required. Options to render ({ id, label, isDisabled? }); see the twin.
rules RegisterOptions — Extra react-hook-form rules; merged with the built-in required rule.
shouldUnregister boolean — Unregister the field (drop its value) on unmount.
isRequired boolean false Adds a required rule and the required indicator.
requiredMessage string localized Message for the required rule.
onChange (value: ValueId[] | null, event?) => void — Called after the field value updates.
onChangeConfirm (value: ValueId[] | null) => Promise<boolean> — Async guard run before committing a change; the value is written only if it resolves true.

All other props (label, hasHiddenLabel, helperText, …) are forwarded to the twin — see @uxf/ui/checkbox-list. Note the group label uses hasHiddenLabel (not hiddenLabel).

Validation

  • isRequired adds a required rule; its message defaults to a localized string (EN: "This field is required") and can be overridden with requiredMessage.
  • Add further rules via rules; the field-level error is shown as the twin's helperText and sets isInvalid.

Requirements

  • Must be rendered inside a Form — it reads the form context (formId, and inherits isDisabled / isReadOnly) and needs a react-hook-form control.
  • Ships no CSS of its own; it renders @uxf/ui/checkbox-list, so include that component's stylesheet(s) and the @uxf/ui token layer — see @uxf/ui/checkbox-list.

Links

  • Visual/primitive twin: @uxf/ui/checkbox-list
Default
Open in new tab