24 lines
532 B
TypeScript
24 lines
532 B
TypeScript
import { ReactNode } from "react";
|
|
|
|
type Option = { label: string; value: string };
|
|
|
|
type Props = {
|
|
label: string;
|
|
children?: ReactNode;
|
|
type?: "text" | "password" | "checkbox" | "textarea" | "select";
|
|
value?: string | boolean;
|
|
onValueChange?: (value: string) => void;
|
|
options?: Option[];
|
|
placeholder?: string;
|
|
rows?: number;
|
|
};
|
|
|
|
export default function FormField({ label, children, type = "text", ...props }: Props) {
|
|
return (
|
|
<label className="form-label">
|
|
{label}
|
|
{children}
|
|
</label>
|
|
);
|
|
}
|