FormLabel
Form-context wrapper around the Label primitive — adds Required, Optional, and Error state markers
SSR mode
Examples
Default label
Required label
Error state
API
The element family below can be composed together. Click an element to jump to its properties.
| Element | Purpose |
|---|---|
| FormLabel | A form-context wrapper around the Label primitive. Adds a required asterisk (*), an optional badge, or an error colour override on top of the base label styles. Required and Optional are mutually exclusive; Error applies independently. |
FormLabel
A form-context wrapper around the Label primitive. Adds a required asterisk (*), an optional badge, or an error colour override on top of the base label styles. Required and Optional are mutually exclusive; Error applies independently.
| Property | Type | Required | Description |
|---|---|---|---|
| For | string? | Maps to the for attribute of the underlying <label> element. Pass the id of the associated input. | |
| Required | bool | Appends a red asterisk (* in text-danger-fg) after the label text. Default: false. Mutually exclusive with Optional. | |
| Optional | bool | Appends a muted (optional) marker after the label text. Default: false. Mutually exclusive with Required. | |
| Error | bool | Overrides the label colour to text-danger-fg to signal a validation error. Default: false. | |
| ChildContent | RenderFragment? | Label text or content. |