Text field
Accepts one line of text, with a label and validation.
text-field-basic-demo.tsx
Installation
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
npm
yarn
pnpm
bun
Composition
TextFieldOwns the value and validation state.
TextFieldLabelTextFieldInputTextFieldDescriptionTextFieldError
Description
Use 3 to 20 letters or numbers.
text-field-description-demo.tsx
Disabled
text-field-disabled-demo.tsx
Read only
text-field-read-only-demo.tsx
Invalid
Enter a valid email address.
text-field-invalid-demo.tsx
Sizes
Give a button next to the field the same size.
text-field-sizes-demo.tsx
API reference
vip/ui adds or changes the props below. For all other props, see React Aria TextField (opens in a new tab).
- size: "xs" | "sm" | "md" | "lg" | "xl" = "lg"
- Sets the height, padding, radius, text, and icon size of the field. The parts inside the field use it.
- label: string
- Label above the field in the default layout.
- description: string
- Help text below the field in the default layout.
- placeholder: string
- Input placeholder in the default layout.