mirror of
https://github.com/Open-Dev-Society/OpenStock.git
synced 2026-05-07 22:15:49 +08:00
26 lines
884 B
TypeScript
26 lines
884 B
TypeScript
import React from 'react'
|
|
import {Label} from "@/components/ui/label";
|
|
import {Input} from "@/components/ui/input";
|
|
import {cn} from "@/lib/utils";
|
|
|
|
const InputField = ({name, label, placeholder, type ="text", register, error, validation, disabled, value}: FormInputProps) => {
|
|
return (
|
|
<div className="space-y-2">
|
|
<Label htmlFor={name} className="form-label">
|
|
{label}
|
|
</Label>
|
|
<Input
|
|
type={type}
|
|
id={name}
|
|
placeholder={placeholder}
|
|
disabled={disabled}
|
|
value={value}
|
|
className={cn('form-input', {'opacity-50 cursor-not-allowed': disabled})}
|
|
{...register(name, validation)}
|
|
/>
|
|
{error && <p className="text-red-500">{error.message}</p>}
|
|
</div>
|
|
)
|
|
}
|
|
export default InputField
|