Skip to content
Alea0.1

Forms

TextField

Text input with label, help text, validation, prefix and suffix. TextArea for longer text, growing if you want.

Ant Design: Input, Input.TextArea

import { TextField, TextArea } from '@alea/ui';

Examples

Text field

A label, help text and a placeholder that is only an example.

We send the license key here.

Validation

Required fields and your own rules. The error shows after the field is used, and on submit.

Letters, numbers and dashes.

Prefix, suffix and sizes

Text or icons inside the field.

https://.com

TextArea

Longer text. autoGrow grows with the content up to maxRows.

Grows as you type.

Props

TextField props

A single-line text input with label, help, error, prefix and suffix.

PropTypeDefaultDescription
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, or a function of the validation result. Shown when invalid.
labelReactNode-The visible label. Use aria-label instead only when the context makes it obvious.
placeholderstring-An example of what to type; never a replacement for the label.
prefixReactNode-Icon or text inside the field, before the value.
showOptionalboolean-Shows "(optional)" after the label.
size"sm" | "md" | "lg"'md'sm 32 px, md 44 px (default), lg 48 px.
suffixReactNode-Icon or text inside the field, after the value.

TextArea props

Multi-line text, optionally growing with its content.

PropTypeDefaultDescription
autoGrowboolean-Grows with the text up to maxRows.
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, or a function of the validation result. Shown when invalid.
labelReactNode-The visible label. Use aria-label instead only when the context makes it obvious.
maxRowsnumber12With autoGrow, the most lines before it scrolls. Default 12.
placeholderstring-An example of what to type.
rowsnumber4Visible lines. Default 4.
showOptionalboolean-Shows "(optional)" after the label.
size"sm" | "md" | "lg"'md'sm 32 px, md 44 px (default), lg 48 px.

Accessibility

  • The label, help text and error are tied to the input, so screen readers read all three.
  • Errors appear after the field is used or on submit, and the field is marked invalid.
  • Required fields are marked with * and required in the accessibility tree.

Keyboard

KeyDoes
TabMoves into the field

Do and don't

Do

  • Always show a visible label.
  • Say how to fix an error: Use at least 8 characters.
  • Use autoComplete so browsers fill it in.

Don't

  • Don't use placeholder text as the label.
  • Don't validate on every keystroke before the person is done.

In Figma

Text field set: Size × State (Default, Hover, Focus, Filled, Invalid, Disabled) with Label, Help and Error properties.

Tested with axe, keyboard and screen reader roles