Forms
Text field
stableSingle-line input with label, description, validation and adornments.
since v1.02.3 kB gzip
Preview
Will deploy to aurora-docs.strata.app
Installation
npx @strata/cli add text-fieldUsage
import { TextField } from "@/components/strata";
<TextField
label="Project name"
description="Lowercase, no spaces."
validate={(v) => (/\s/.test(v) ? "No spaces allowed" : null)}
/>Props
| Prop | Type | Default |
|---|---|---|
labelVisible label. | ReactNode | — |
descriptionHelper text below the input. | ReactNode | — |
isRequiredMarks the field required and validates on submit. | boolean | false |
validateCustom validation returning an error message. | (value: string) => string | null | — |
prefixIcon or text before the input. | ReactNode | — |
isDisabledPrevents interaction and dims the control. | boolean | false |
Accessibility
Related
Select
Pick one option from a list, with typeahead and sections.
Checkbox
Binary choice with indeterminate state and grouped variants.
Switch
Instant on/off setting, typically in settings lists.
Slider
Choose a value or range along a track, with steps and output.
Was this page helpful?
Documented since v1.0 · components/text-field.mdx