Text Field
FreeA labeled text input with clear focus and placeholder states.
npx shadcn@latest add @ui-shrushank/text-fieldThe install writes a single file to components/ui/TextField.tsx, which exports TextField.
tsx
import { TextField } from "@/components/ui/TextField";tsx
<TextField label="Label" />The labelled input baseline.
Always a real <label>, distinct focus and placeholder states, custom focus ring with the browser outline suppressed.
Placeholder text is not a label substitute (it vanishes on type); pairing them removes the "what was this field?" problem once the user starts typing.
Every line below was read out of the file you are about to copy, so you can check each one against the source at the bottom of this page.
- Pairs every input with a real
<label>, so the field keeps its name after the placeholder disappears.
1 required, 0 optional.
| Prop | Type | Default |
|---|---|---|
labelrequired | string | none |
labelrequiredstring
One file, no runtime package. Copy it, or install it with the command at the top of this page.
TextField.tsx
TypeScript