ToggleField
Labelled toggle field with inline layout — wraps the Toggle primitive with a right-side label and optional help text
Interactive-mode
Examples
Default toggle field
Toggle field with help text
Automatically save changes as you type.
API
The element family below can be composed together. Click an element to jump to its properties.
| Element | Purpose |
|---|---|
| ToggleField | A labelled toggle field chunk with inline layout. The toggle button sits on the left; the label and optional help text stack to the right. Wraps the Toggle primitive. The Toggle primitive is designed to host an icon glyph — pass IconSvg for the common case of icon-bearing toggles. |
ToggleField
A labelled toggle field chunk with inline layout. The toggle button sits on the left; the label and optional help text stack to the right. Wraps the Toggle primitive. The Toggle primitive is designed to host an icon glyph — pass IconSvg for the common case of icon-bearing toggles.
| Property | Type | Required | Description |
|---|---|---|---|
| Label | string? | Label text rendered to the right of the toggle via FormLabel. Omit to hide the label. | |
| IconSvg | string? | Optional SVG path rendered as <Icon Svg="..." ClassName="size-4" /> inside the toggle button. The Toggle primitive is designed to host icon glyphs, so most consumers will want to pass one (e.g. IconSvg.FormatBold). | |
| HelpText | string? | Helper text rendered below the label. Shown in text-danger-fg when Error is true, otherwise text-muted-foreground. | |
| Error | bool | Applies error styling to the label and help text. Default: false. | |
| Required | bool | Appends a red asterisk to the label via FormLabel. Default: false. | |
| Disabled | bool | Disables the underlying toggle. Default: false. | |
| Id | string | HTML id wired to the label's for attribute. Auto-generated by default. | |
| Value | bool | Whether the toggle is active (pressed). Use @bind-Value for two-way binding. | |
| ValueChanged | EventCallback<bool> | Fires when the pressed state changes. Part of the @bind-Value pair. |