Skip to Content
APIType AliasesType Alias: CheckboxGroupFieldProps<TFieldValues, TValue>

Hero Hook Form API v2.15.0


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?

optional checkboxProps: CheckboxGroupPassthroughProps

Additional props to pass to individual Checkbox components

orientation?

optional orientation: "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} />