Skip to Content
ComponentsTextField

TextField

A form component for text input. Built on Base UI Field  and Base UI Input  to provide label, input area, and helper text in a single component. Use the multiline prop to render a <textarea> instead of <input>.

Preview

We'll never share your email.

Examples

Variant

Controls the visual style of the input field.

ValueDefaultDescription
outlineDefault bordered input style.
filledFilled background. Use when you need to distinguish from other form elements.

Status

Indicates validation state. Border and helper text colors change based on status.

ValueDefaultDescription
defaultDefault state.
errorValidation failed. Use helperText for the error message.
successValidation passed. Use helperText for the success message.

Looks good!

Size

Controls the input field size.

ValueDefaultDescription
smallFor dense forms.
mediumGeneral form use.
largeWhen a larger input area is needed.
xlargeWhen a large input area is needed.

Rounded

Controls the corner radius.

ValueDefaultDescription
smallSmall corner radius
mediumDefault corner radius
largeLarge corner radius

Multiline

When true, renders a <textarea> instead of <input>. Use the rows prop to set the default height.

Guidelines

Showing error state

Use status="error" with helperText to explain what went wrong. A clear message helps users understand what to fix.

<TextField label="Email" status="error" helperText="Please enter a valid email address." value={email} onChange={(e) => setEmail(e.target.value)} />

Props

Props

Prop
Default
Type
size?
"medium"
"small" | "medium" | "large" | "xlarge"
rounded?
"medium"
"small" | "medium" | "large"
variant?
"outline"
"outline" | "filled"
status?
"default"
"default" | "error" | "success"
label?
string
helperText?
string
fullWidth?
false
boolean
name?
string
required?
boolean
validate?
(value: unknown, formValues: Record<string, unknown>) => string | string[] | Promise<string | string[] | null> | null
multiline?
false
boolean
rows?
3
number
Last updated on