Hero Hook Form API / CheckboxFieldProps
Type Alias: CheckboxFieldProps<TFieldValues>
CheckboxFieldProps<
TFieldValues> =FieldBaseProps<TFieldValues,boolean> &WithControl<TFieldValues> &object
Defined in: fields/CheckboxField.tsx:35
Props for the CheckboxField component.
Type Declaration
checkboxProps?
optionalcheckboxProps:Omit<React.ComponentProps<typeofCheckbox>,"isSelected"|"onValueChange"|"isInvalid"|"errorMessage"|"isDisabled">
Additional props to pass to the underlying Checkbox component
Type Parameters
TFieldValues
TFieldValues extends FieldValues
The form data type
Example
import { CheckboxField } from "@rachelallyson/hero-hook-form";
import { useForm } from "react-hook-form";
const form = useForm({
defaultValues: { newsletter: false },
});
<CheckboxField
control={form.control}
name="newsletter"
label="Subscribe to newsletter"
description="Receive weekly updates"
/>