feat: enhance TextEditor and Input components with improved styling and error handling

This commit is contained in:
Ardeman
2025-03-06 03:53:15 +08:00
parent 9117a99cc3
commit 894698c5d6
6 changed files with 97 additions and 23 deletions
+3 -1
View File
@@ -23,6 +23,7 @@ type TInputProperties<T extends FieldValues> = Omit<
name: Path<T>
rules?: RegisterOptions
containerClassName?: string
labelClassName?: string
}
export const Input = <TFormValues extends Record<string, unknown>>(
@@ -38,6 +39,7 @@ export const Input = <TFormValues extends Record<string, unknown>>(
disabled,
className,
containerClassName,
labelClassName,
...rest
} = properties
const [inputType, setInputType] = useState(type)
@@ -55,7 +57,7 @@ export const Input = <TFormValues extends Record<string, unknown>>(
disabled={disabled}
id={id}
>
<Label className="mb-1 block text-gray-700">
<Label className={twMerge('mb-1 block text-gray-700', labelClassName)}>
{label} {error && <span className="text-red-500">{error.message}</span>}
</Label>
<HeadlessInput