import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef } from "react" import { useFormContext } from "react-hook-form" import { ErrorMessage } from "@hookform/error-message" export interface LabeledSelectFieldProps extends PropsWithoutRef { /** Field name. */ name: string /** Field label. */ label: string /** Field type. Doesn't include radio buttons and checkboxes */ options: any[] outerProps?: PropsWithoutRef labelProps?: ComponentPropsWithoutRef<"label"> } export const LabeledSelectField = forwardRef( ({ label, outerProps, labelProps, name, options, ...props }, ref) => { const { register, formState: { isSubmitting, errors }, } = useFormContext() return (
(
{message}
)} errors={errors} name={name} />
) } )