Toggle Group

A row of toggles where one, or several, can be pressed.

Installation

bash
shellui-native add toggle-group

Platforms: MAUI · Avalonia. Also installs icon, element-extensions.

Usage

Single

Rendered with ShellUI for Blazor
<ui:ToggleGroup Value="center">
    <ui:ToggleGroupItem Value="left" Text="Left" />
    <ui:ToggleGroupItem Value="center" Text="Center" />
    <ui:ToggleGroupItem Value="right" Text="Right" />
</ui:ToggleGroup>
Avalonia, running in your browser

Multiple

Rendered with ShellUI for Blazor
<ui:ToggleGroup Multiple="True" Values="{Binding Formats}">
    <ui:ToggleGroupItem Value="bold" Text="B" />
    <ui:ToggleGroupItem Value="italic" Text="I" />
    <ui:ToggleGroupItem Value="underline" Text="U" />
</ui:ToggleGroup>
Avalonia, running in your browser

MAUI and Avalonia

On Avalonia the items are also tab stops, pressed with Enter or Space.

API

ToggleGroup

XAML children go to Items.

Property Type Default Description
Multiple bool false Allows several items to be pressed at once.
Value string — Pressed item with Multiple="False". Two-way bindable.
Values IList<string> (MAUI) · IList<string>? (Avalonia) null The pressed items' Values in Multiple mode.
Variant ToggleGroupVariant Default Visual style. One of Default, Outline.
Event Arguments Description
ValueChanged string? User input only: setting Value or Values from code or a binding doesn't raise them.
ValuesChanged IReadOnlyList<string> The selection changed.
Method Description
IsPressed(string value) Whether it's pressed. Two-way bindable.

ToggleGroupItem

Property Type Default Description
Value string — Value this item stands for.
Text string — Text shown by the component.
Icon IconName None Lucide icon from IconName; None for no icon.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.