import * as UI from "@/ui"; import * as LabelPrimitive from "@radix-ui/react-label"; import { t } from "i18next"; import React from "react"; import { FormInputProps } from "./FormProps"; export interface FormLabelProps { label: string; hint?: string; } export const FormLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & FormLabelProps & Pick >(({ label, hint, required, ...props }, ref) => { const { error } = UI.useFormField(); const _hint = hint ? hint : required ? t("common.required") : undefined; const _hintClassName = error ? "text-destructive font-semibold" : ""; return ( {label} {_hint && {_hint}} ); }); FormLabel.displayName = "FormLabel";