Updated forms
This commit is contained in:
@@ -81,8 +81,12 @@ function FormItem({ className, ...props }: React.ComponentProps<"div">) {
|
||||
|
||||
function FormLabel({
|
||||
className,
|
||||
required,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root> & {
|
||||
required?: boolean
|
||||
}) {
|
||||
const { error, formItemId } = useFormField()
|
||||
|
||||
return (
|
||||
@@ -92,7 +96,10 @@ function FormLabel({
|
||||
className={cn("data-[error=true]:text-destructive", className)}
|
||||
htmlFor={formItemId}
|
||||
{...props}
|
||||
/>
|
||||
>
|
||||
{children}
|
||||
{required && <span className="text-destructive">*</span>}
|
||||
</Label>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user