Skip to content

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.json

Preview

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.json

GitHub 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.json

Usage

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.

PropTypeDefault
namestring—
invalidboolean—
  • invalid — Force an invalid state.

TextFieldError

PropTypeDefault
matchValidityState key | function—
  • match — When to show the message (e.g. `valueMissing`).