Skip to main content

Configure the following properties on the textField component.

Configure the following properties on the text field component.

Anchor to details
details
string

Additional text to provide context or guidance for the field. This text is displayed along with the field and its label to offer more information or instructions to the user.

This will also be exposed to screen reader users.

Anchor to disabled
disabled
boolean
Default: false

Disables the field, disallowing any interaction.

Anchor to error
error
string

Indicate an error to the user. The field will be given a specific stylistic treatment to communicate problems that have to be resolved immediately.

string

A unique identifier for the element.

Anchor to label
label
string

Content to use as the field label.

Anchor to maxLength
maxLength
number
Default: Infinity

Specifies the maximum number of characters allowed.

Anchor to placeholder
placeholder
string

A short hint that describes the expected value of the field.

Anchor to required
required
boolean
Default: false

Whether the field needs a value. This requirement adds semantic value to the field, but it will not cause an error to appear automatically. If you want to present an error when this field is empty, you can do so with the error property.

Anchor to value
value
string

The current value for the field. If omitted, the field will be empty.


The textField component supports slots for additional content placement within the field. Learn more about using slots.

The text field component supports slots for additional content placement within the field. Learn more about using slots.

Anchor to accessory
accessory
HTMLElement

Additional content to be displayed in the field. Commonly used to display clickable text.


The textField component provides event callbacks for handling user interactions. Learn more about handling events.

The text field component provides event callbacks for handling user interactions. Learn more about handling events.

(event: <"s-text-field">) => void

Callback when the element loses focus.

Anchor to change
change
(event: <"s-text-field">) => void

Callback after editing completes (typically on blur).

Anchor to focus
focus
(event: <"s-text-field">) => void

Callback when the element receives focus.

Anchor to input
input
(event: <"s-text-field">) => void

Callback when the user makes any changes in the field.



  • Use for single-line text input: Choose textField for short values like names, titles, or identifiers. For multi-line content, use textArea.
  • Show character limit feedback: When approaching maxLength, display remaining characters in the details text.
  • Write descriptive labels: Use specific labels like "Product Name" or "Reference Code" rather than generic terms.

The accessory slot supports only button and clickable components with text content only—other component types or complex layouts can't be used for field accessories.


Was this page helpful?