react-hook-form-bound multi-value dropdown. Wraps the @uxf/ui/multi-select primitive and manages its value, isInvalid, and helperText from form state.
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.
@uxf/form/multi-combobox.@uxf/form/select.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).
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).
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.rules; they are merged with the built-in rule.helperText and sets isInvalid.Form — it reads the form context (formId for the default id = ${formId}__${name}, and inherits isDisabled / isReadOnly) and needs a react-hook-form control.options is empty (in addition to the form's isDisabled and the field's own isDisabled).@uxf/ui/multi-select, so include that component's stylesheet(s) and the @uxf/ui token layer — see @uxf/ui/multi-select.@uxf/ui/multi-select