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?
optionaldateProps:Omit<React.ComponentProps<typeofDateInput>,"value"|"onChange"|"label"|"isInvalid"|"errorMessage"|"isDisabled">
Additional props to pass to the underlying DateInput component
transform()?
optionaltransform: (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"
/>