Label
A form label component. for points to the target control's id, and clicking focuses the control; supports a required asterisk and its position.
Basic usage
Basic label
Required asterisk
required appends a * marker; position places the asterisk before (before) or after (after, default) the text.
Required asterisk
Asterisk before
Plain text label
Without for, only text is rendered and clicks don't forward focus; long text wraps instead of overflowing.
Plain text & long text
API
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
for | Target control id; click forwards to getElementById(for).focus() | string | — |
position | Position of the asterisk relative to the text | string | after |
required | Append a required * marker (aria-hidden) | boolean | — |
Slots
| Name | Description |
|---|---|
| default | — |
Note:
foris also synced to the native<label>forattribute; the click behavior is manually forwarded and can focus the target control across Shadow DOM.