Hero Hook Form API / CheckboxGroupFieldProps
Type Alias: CheckboxGroupFieldProps<TFieldValues, TValue>
CheckboxGroupFieldProps<
TFieldValues,TValue> =FieldBaseProps<TFieldValues,TValue[]> &WithControl<TFieldValues> &object
Defined in: fields/CheckboxGroupField.tsx:63
Props for the CheckboxGroupField component.
Type Declaration
options
options: readonly
CheckboxOption<TValue>[]
Array of checkbox options
checkboxProps?
optionalcheckboxProps:CheckboxGroupPassthroughProps
Additional props to pass to individual Checkbox components
orientation?
optionalorientation:"vertical"|"horizontal"
Layout orientation for the checkboxes
Type Parameters
TFieldValues
TFieldValues extends FieldValues
The form data type
TValue
TValue extends string | number = string
The value type for the checkbox group (string or number)
Example
import { CheckboxGroupField } from "@rachelallyson/hero-hook-form";
import { useForm } from "react-hook-form";
const form = useForm({
defaultValues: { interests: [] },
});
const options = [
{ label: "Reading", value: "reading" },
{ label: "Sports", value: "sports" },
{ label: "Music", value: "music" },
];
<CheckboxGroupField
control={form.control}
name="interests"
label="Interests"
options={options}
/>