Text Input

GitHub

Text input with native support.

Installation

bash
pnpm dlx shadcn@latest add @cs/text-input

Usage

tsx
import { TextInput } from "@/components/cs/text-input";
tsx
<TextInput name="username" label="Username" />

API Reference

TextInput

Text input with native support.

Props

NameTypeDefaultDescription
buttonOmit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> | undefined-Button displayed inside the input on the right.
defaultValuestring-Initial text value for uncontrolled usage.
errorstring | null | undefined-Validation error message for the field.
iconReactNode-Icon displayed inside the input on the left.
inputClassNamestring | undefined-Additional classes applied to the native input control.
labelReactNode-Field label and fallback placeholder.
onValueChange(value: string) => void-Called with the current text value when it changes.
orientation"vertical" | "horizontal" | "responsive" | null | undefined-Layout of the field label and input control.
valuestring-Controlled text value.

Dependencies