Skip to Content
ContentAPIType AliasesType Alias: SwitchFieldProps<TFieldValues>

Hero Hook Form API v2.5.1


Hero Hook Form API / SwitchFieldProps

Type Alias: SwitchFieldProps<TFieldValues>

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

Defined in: fields/SwitchField.tsx:35 

Props for the SwitchField component.

Type Declaration

switchProps?

optional switchProps: Omit<React.ComponentProps<typeof Switch>, "isSelected" | "onValueChange" | "isInvalid" | "isDisabled">

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" />