• 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

MultiSelect

react-hook-form-bound multi-value dropdown. Wraps the @uxf/ui/multi-select primitive and manages its value, isInvalid, and helperText from form state.

When to use

Use @uxf/form/multi-select for a multi-choice picker (no text filtering) inside a @uxf/form form — it registers the field with react-hook-form via control/name and renders validation errors automatically. For a standalone, manually-controlled multi-select (outside a form), use the @uxf/ui/multi-select twin directly.

  • Need to filter options by typing? Use @uxf/form/multi-combobox.
  • Only one value? Use @uxf/form/select.

Usage

import { Form } from "@uxf/form/form";
import { MultiSelect, MultiSelectValue } from "@uxf/form/multi-select";
import { MultiSelectOption } from "@uxf/ui/multi-select";
import { useForm } from "react-hook-form";

interface FormData {
    tags: MultiSelectValue<string>;
}

const options: MultiSelectOption<string>[] = [
    { color: "red", id: "one", label: "Option one" },
    { color: "blue", id: "two", label: "Option two" },
    { id: "three", label: "Option three" },
];

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

    return (
        <Form formApi={formApi} id="example" onSubmit={(values) => console.log(values)}>
            <MultiSelect
                control={formApi.control}
                isRequired
                label="Tags"
                name="tags"
                options={options}
                placeholder="Select..."
            />
        </Form>
    );
}

The react-hook-form value is an array of ids (MultiSelectValue<T> = T[] | null) — not option objects — the same shape as the @uxf/ui/multi-select twin. It is read from and written to the twin unchanged (no normalisation).

Props

MultiSelectProps<FormData> = ControlProps<FormData> + the visual props of the @uxf/ui/multi-select twin (minus the ones this field manages: isFocused, isInvalid, name, onChange, value) + the field-specific props below.

Prop Type Default Description
control Control<FormData> — Required. The control from useForm.
name FieldPath<FormData> — Required. Field path in the form values.
rules RegisterOptions — Extra react-hook-form rules; merged with the built-in required rule below.
shouldUnregister boolean — Unregister the field (drop its value) on unmount.
isRequired boolean false Adds a required rule and the required indicator on the label.
requiredMessage string localized Overrides the required rule message.
onChange (value: T[], event) => void — Called after the field value updates.
onChangeConfirm (value) => Promise<boolean> — Async gate: the change is committed only if the returned promise resolves true.

All visual props (label, options, placeholder, withCheckboxes, size, variant, helperText, keyExtractor, iconName, allOptionsSelectedMessage, leftAddon/rightAddon/leftElement/rightElement, the dropdown* props, …) are forwarded to the twin — see @uxf/ui/multi-select. Note there is no isClearable (the twin is not clearable).

Validation

  • isRequired adds a required rule; override its message with requiredMessage (default localized "This field is required", key uxf-form-multi-select:validation.required). The rule fails on null/undefined, not on an empty array — seed the field with [] if you want it left explicitly empty.
  • Add any further rules via rules; they are merged with the built-in rule.
  • 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 for the default id = ${formId}__${name}, and inherits isDisabled / isReadOnly) and needs a react-hook-form control.
  • The control is auto-disabled when options is empty (in addition to the form's isDisabled and the field's own isDisabled).
  • Ships no CSS of its own; it renders @uxf/ui/multi-select, so include that component's stylesheet(s) and the @uxf/ui token layer — see @uxf/ui/multi-select.

Links

  • Visual/primitive twin: @uxf/ui/multi-select
Default
Open in new tab