Skip to main content

Textfield

Base text entry form control covering the standard single-line input types: text, email, password, tel, url, and search. Styled via element selectors so a plain <input> picks up the design system look without a class. Provides placeholder, focus, disabled, read-only, and validation states. type="email", type="tel", and type="url" render a decorative icon that can be suppressed via data-textfield-icon="none".

Usage​

When to use

  • Any single-line textual data entry inside a form
  • When the consumer wants native <input> semantics styled to match the design system without extra markup
  • Short free-text fields like name, email, phone number, or URL

When not to use

  • Multi-line text entry - use the textarea component
  • Date or time input - use the datepicker or timepicker component
  • File upload - use the upload component

Do

  • Pair every input with a visible <label> (or an associated hidden label)
  • Use the most specific type so mobile keyboards and browser validation activate correctly
  • Use readonly for values the user should see but not change; use disabled only when the field is not part of the current flow

Don't

  • Rely on placeholder as a label - it disappears when the user starts typing and has poor contrast
  • Use disabled to communicate validation errors - use aria-invalid instead

API​

Slots​

SlotRequiredDescription
labelYesVisible label text for the input.
placeholder-Placeholder text shown when the input is empty.
value-Pre-filled value.
helper-Helper text rendered below the input.

Props​

PropTypeDefaultDescription
namestring-Name attribute for form submission.
idstring-Associates the control with its label. Auto-generated when omitted.
typeEnum: text, email, password, tel, url, search-Input type.
is_disabledboolean-Disables the control.
is_readonlyboolean-Renders the control as read-only.
is_requiredboolean-Marks the control as required.
is_invalidboolean-Marks the control as invalid. Renders aria-invalid="true" when set.
helper_idstring-ID of the helper element; the control gets aria-describedby pointing to it.
autocompletestring-Value for the autocomplete attribute.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.smSize-Small.
.mdSizeYesMedium.
.lgSize-Large.

Examples​

Sizes​

Sm, default, and lg variants stacked vertically. Font size and padding scale together.

Text​

Default type="text" input.

Email​

type="email" with email icon.

Password​

type="password" input.

Tel​

type="tel" with phone icon.

URL​

type="url" with link icon.

type="search" input.

Placeholder​

Styled placeholder text.

Focused​

Focus ring and border shadow.

Disabled​

Disabled state.

Read-only​

Read-only state with distinct background.

Invalid​

Validation error state with cross icon and aria-invalid="true".

Icon opt-out​

Suppressing the type-based icon via data-textfield-icon="none".

Required​

A required field, where the preceding label picks up its asterisk from the control rather than from any markup of its own.

Accessibility​

  • WCAG 2.2 AA
  • Native <input> semantics preserved in every variant
  • Visible focus ring on keyboard focus
  • readonly keeps the element in tab order; disabled removes it - use accordingly.
  • Validation state surfaced via aria-invalid
  • Type-based icons are decorative and hidden from assistive tech.
  • Placeholder text meets WCAG AA contrast.
  • Error messages are associated with the input via aria-describedby.