Files
writer-work-flow/apps/web/components/ui/TextInput.tsx
2026-06-28 07:31:20 +02:00

31 lines
658 B
TypeScript

import type { InputHTMLAttributes } from "react";
import { cn, inputClass, type InputState } from "@/lib/ui/variants";
interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
controlSize?: "sm" | "md";
state?: InputState;
}
const inputSizes: Record<NonNullable<TextInputProps["controlSize"]>, string> = {
sm: "px-2 py-1 text-xs",
md: "px-3 py-2 text-sm",
};
export function TextInput({
className,
controlSize = "md",
state,
...props
}: TextInputProps) {
return (
<input
className={inputClass({
state,
className: cn(inputSizes[controlSize], className),
})}
{...props}
/>
);
}