Label
Renders an accessible label associated with a control.
Click the label above to focus the field.
<NaviusLabel For="email" class="text-sm font-medium leading-none">
Email address
</NaviusLabel>
<input id="email" type="email" class="..." />Features
- Associates with a control via
Forso clicking the label focuses it. - Prevents text selection when the label is double-clicked.
- Forwards any extra attributes onto the underlying
<label>.
Installation
Install the brain, or copy just this primitive in with the CLI.
navius add labelAnatomy
Import the part and assemble it.
@using Navius.Primitives.Components.Label
<NaviusLabel For="control-id">Label text</NaviusLabel>API Reference
Root
Contains the content of the label. Renders a label element.
| Prop | Type | Default |
|---|---|---|
| For | string? | - |
| ChildContent | RenderFragment? | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-navius-label] | Present on the root element |
Accessibility
Follows the native label element semantics. Set For to the id of the control so assistive technology announces the label as the control's accessible name.
Keyboard interactions
The label has no keyboard interactions of its own. Activating it with the pointer moves focus to, and where applicable activates, the associated control.