diff --git a/src/form-control.tsx b/src/form-control.tsx index 1fb918f..6fefe44 100644 --- a/src/form-control.tsx +++ b/src/form-control.tsx @@ -4,9 +4,12 @@ import { Slot } from "@radix-ui/react-slot" import React, { forwardRef } from "react" import { useFormField } from "./hooks/use-form-field" +export interface FormControlProps + extends React.ComponentPropsWithoutRef {} + export const FormControl = forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef + FormControlProps >(({ ...props }, ref) => { const { error, formItemId, formDescriptionId, formMessageId } = useFormField() diff --git a/src/form-description.tsx b/src/form-description.tsx index 4c395ca..42fd360 100644 --- a/src/form-description.tsx +++ b/src/form-description.tsx @@ -4,9 +4,12 @@ import { forwardRef, HTMLAttributes } from "react" import { useFormField } from "./hooks/use-form-field" import { cn } from "./utils" +export interface FormDescriptionProps + extends HTMLAttributes {} + export const FormDescription = forwardRef< HTMLParagraphElement, - HTMLAttributes + FormDescriptionProps >(({ className, ...props }, ref) => { const { formDescriptionId } = useFormField() diff --git a/src/form-item.tsx b/src/form-item.tsx index dc8ca5c..57cbdd4 100644 --- a/src/form-item.tsx +++ b/src/form-item.tsx @@ -4,17 +4,18 @@ import { forwardRef, HTMLAttributes, useId, useMemo } from "react" import FormItemContext from "./context/form-item-context" import { cn } from "./utils" -export const FormItem = forwardRef< - HTMLDivElement, - HTMLAttributes ->(({ className, ...props }, ref) => { - const id = useId() +export interface FormItemProps extends HTMLAttributes {} - return ( - ({ id }), [id])}> -
- - ) -}) +export const FormItem = forwardRef( + ({ className, ...props }, ref) => { + const id = useId() + + return ( + ({ id }), [id])}> +
+ + ) + } +) FormItem.displayName = "FormItem" diff --git a/src/form-label.tsx b/src/form-label.tsx index a687533..f776a1e 100644 --- a/src/form-label.tsx +++ b/src/form-label.tsx @@ -4,22 +4,24 @@ import React, { forwardRef } from "react" import { useFormField } from "./hooks/use-form-field" import { cn } from "./utils" -export const FormLabel = forwardRef< - React.ElementRef<"label">, - React.ComponentPropsWithoutRef<"label"> ->(({ className, ...props }, ref) => { - const { error, formItemId, name } = useFormField() +export interface FormLabelProps + extends React.ComponentPropsWithoutRef<"label"> {} - return ( -