Skip to Content
ContentAPIType AliasesType Alias: DateFieldProps<TFieldValues>

Hero Hook Form API v2.5.1


Hero Hook Form API / DateFieldProps

Type Alias: DateFieldProps<TFieldValues>

DateFieldProps<TFieldValues> = FieldBaseProps<TFieldValues, CalendarDate | null> & WithControl<TFieldValues> & object

Defined in: fields/DateField.tsx:37 

Props for the DateField component.

Type Declaration

dateProps?

optional dateProps: Omit<React.ComponentProps<typeof DateInput>, "value" | "onChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">

Additional props to pass to the underlying DateInput component

transform()?

optional transform: (value) => CalendarDate | null

Transform function to modify the date value before it’s set

Parameters

value

CalendarDate | null

Returns

CalendarDate | null

Type Parameters

TFieldValues

TFieldValues extends FieldValues

The form data type

Example

import { DateField } from "@rachelallyson/hero-hook-form"; import { useForm } from "react-hook-form"; import { CalendarDate } from "@internationalized/date"; const form = useForm({ defaultValues: { birthDate: null as CalendarDate | null }, }); <DateField control={form.control} name="birthDate" label="Birth Date" description="Select your date of birth" />