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
textareacomponent - Date or time input - use the
datepickerortimepickercomponent - File upload - use the
uploadcomponent
Do
- Pair every input with a visible
<label>(or an associated hidden label) - Use the most specific
typeso mobile keyboards and browser validation activate correctly - Use
readonlyfor values the user should see but not change; usedisabledonly when the field is not part of the current flow
Don't
- Rely on
placeholderas a label - it disappears when the user starts typing and has poor contrast - Use
disabledto communicate validation errors - usearia-invalidinstead
API
Slots
| Slot | Required | Description |
|---|---|---|
label | Yes | Visible 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
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | - | Name attribute for form submission. |
id | string | - | Associates the control with its label. Auto-generated when omitted. |
type | Enum: text, email, password, tel, url, search | - | Input type. |
is_disabled | boolean | - | Disables the control. |
is_readonly | boolean | - | Renders the control as read-only. |
is_required | boolean | - | Marks the control as required. |
is_invalid | boolean | - | Marks the control as invalid. Renders aria-invalid="true" when set. |
helper_id | string | - | ID of the helper element; the control gets aria-describedby pointing to it. |
autocomplete | string | - | Value for the autocomplete attribute. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | 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.
Search
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
readonlykeeps the element in tab order;disabledremoves 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.
Related
- textarea - multi-line text entry
- datepicker - date input
- timepicker - time input
- search - search input pattern
- upload - file input