Form Text Input

GitHub

Text input connected to Form context with server validation errors.

Installation

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

Usage

tsx
import { FormTextInput } from "@/components/cs/form-text-input"
tsx
<FormTextInput name="description" />

API Reference

FormTextInput

Text input connected to Form context with server validation errors.

Props

NameTypeDefaultDescription
buttonOmit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> | undefined-Button displayed inside the input on the right.
defaultValuestring | undefined-Initial text value for uncontrolled usage.
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.
name *string-Form field name used for submission and validation errors.
onValueChange((value: string) => void) | undefined-Called with the current text value when it changes.
orientation"vertical" | "horizontal" | "responsive" | null | undefined-Layout of the field label and input control.
valuestring | undefined-Controlled text value.