Skip to content

Label

Label renders a label associated with a control. Setting For to the control’s id means clicking the label moves focus to (and, where applicable, activates) that control, following native <label> semantics. Double-clicking the label does not select its text.

@using Navius.Primitives.Components.Label
<NaviusLabel />

Contains the content of the label. Renders a label element.

Prop Type Default Description
For string? - The id of the associated control.
ChildContent RenderFragment? - Label content.
Attributes IDictionary<string, object>? - Forwarded to the rendered label.
Part Attribute Description
Root data-navius-label Present on the root element.

Root follows native label element semantics: setting For to a control’s id makes assistive technology announce the label as that control’s accessible name. It has no keyboard interactions of its own; activating it with a pointer moves focus to, and where applicable activates, the associated control. On a double-click, the default browser text-selection is suppressed so the click reads as an activation rather than a text-select gesture. This mechanism is covered by the Playwright browser test suite and gated by axe-core in CI.