Skip to Content
APIType AliasesType Alias: SwitchFieldProps<TFieldValues>

Hero Hook Form API v2.15.0


Hero Hook Form API / SwitchFieldProps

Type Alias: SwitchFieldProps<TFieldValues>

SwitchFieldProps<TFieldValues> = FieldBaseProps<TFieldValues, boolean> & WithControl<TFieldValues> & object

Defined in: fields/SwitchField.tsx:40 

Props for the SwitchField component.

Type Declaration

switchProps?

optional switchProps: SwitchPassthroughProps

Additional props to pass to the underlying Switch component

Type Parameters

TFieldValues

TFieldValues extends FieldValues

The form data type

Example

import { SwitchField } from "@rachelallyson/hero-hook-form"; import { useForm } from "react-hook-form"; const form = useForm({ defaultValues: { notifications: false }, }); <SwitchField control={form.control} name="notifications" label="Enable notifications" description="Receive email notifications" />