Forms
Navigation & layout
Data display & feedback
Date & time
Browse components
← All components
Text Field
Labeled field that composes input, description, and validation error.
Install
npx shadcn@latest add https://ui.anuragroy.dev/r/text-field.jsonPreview
Loading preview…
Installation
Add the component from this site. The shadcn CLI fetches the registry JSON over HTTPS — no named registry submission required.
Terminal
npx shadcn@latest add https://ui.anuragroy.dev/r/text-field.jsonGitHub fallback if the website is down:
Terminal
npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/text-field.jsonUsage
Import paths follow your components.json aliases. After install, the default path is @/components/ui/text-field.
Import
import { TextField, TextFieldLabel, TextFieldInput, TextFieldDescription, TextFieldError} from "@/components/ui/text-field"example.tsx
import { TextField, TextFieldDescription, TextFieldError, TextFieldInput, TextFieldLabel,} from "@/components/ui/text-field"export function Example() { return ( <TextField name="email"> <TextFieldLabel>Email</TextFieldLabel> <TextFieldInput type="email" placeholder="you@example.com" required /> <TextFieldDescription>We'll never share this.</TextFieldDescription> <TextFieldError match="valueMissing">Email is required.</TextFieldError> </TextField> )}API Reference
TextField
Base UI Field root. Use `name` so the input participates in form submit.
| Prop | Type | Default |
|---|---|---|
| name | string | — |
| invalid | boolean | — |
- invalid — Force an invalid state.
TextFieldError
| Prop | Type | Default |
|---|---|---|
| match | ValidityState key | function | — |
- match — When to show the message (e.g. `valueMissing`).