Text Input
GitHubText input with native support.
Installation
bash
pnpm dlx shadcn@latest add @cs/text-inputUsage
tsx
import { TextInput } from "@/components/cs/text-input";tsx
<TextInput name="username" label="Username" />API Reference
TextInput
Text input with native support.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| button | Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> | undefined | - | Button displayed inside the input on the right. |
| defaultValue | string | - | Initial text value for uncontrolled usage. |
| error | string | null | undefined | - | Validation error message for the field. |
| icon | ReactNode | - | Icon displayed inside the input on the left. |
| inputClassName | string | undefined | - | Additional classes applied to the native input control. |
| label | ReactNode | - | 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. |
| value | string | - | Controlled text value. |