Textarea
A multi-line text field with label, description and error built in, taking part in forms.
On this page
Tag <sb-textarea> · status stable · version 0.1.0
Example
<div style="max-width:360px">
<sb-textarea label="Message" placeholder="Write something…"></sb-textarea>
</div>
Properties
| Name | Type | Default | Notes |
|---|---|---|---|
label |
text | Visible label and accessible name. Required: shadow DOM keeps external <label for> from reaching the inner textarea. | |
hideLabel |
boolean | false |
Visually hides the label; it stays the accessible name. |
description |
text | `` | Help text under the field. |
errorMessage |
text | `` | Error message. Setting it marks the field invalid. |
name |
text | `` | Form field name. |
value |
text | `` | Current text; submitted with the form. |
placeholder |
text | `` | Example of the expected input. Never a substitute for the label. |
autocomplete |
text | `` | Native autocomplete token (WCAG 1.3.5 for personal data). |
required |
boolean | false |
Native required, plus an aria-hidden asterisk after the label. Explain * once per form. |
disabled |
boolean | false |
Native disabled; dimmed; not submitted. |
readOnly |
boolean | false |
Focusable and submitted; not editable. |
minlength |
number | Native validation. | |
maxlength |
number | Native validation. |
Events
| Name | Notes |
|---|---|
input |
Each edit. Native and composed, so it crosses the shadow boundary. |
change |
Value committed (blur). Re-dispatched from the host because native change is not composed. Enter inserts a newline and never changes the commit state. |
Keyboard
| Key | Does |
|---|---|
Tab |
move focus in and out |
typing |
native multi-line text editing |
Enter |
inserts a newline; it never submits the owning form (native textarea behavior) |
Accessibility
- Role:
textbox (multi-line) - Native element:
textarea - Accessible name: The label prop, through a native <label for> in the same shadow root.
- Form: ElementInternals: setFormValue on the textarea value, validity mirrored with setValidity (anchored to the inner textarea), formResetCallback restores the default value, disabled fields are not submitted.