Toggle
A two-state button that stays pressed.
Installation
bash
shellui-native add toggle
Platforms: MAUI · Avalonia. Also installs icon.
Usage
Basic
<ui:Toggle Icon="Star" />
<ui:Toggle Icon="Star" Text="Favourite" IsPressed="True" />
<ui:Toggle Text="Outline" Variant="Outline" />
<ui:Toggle Text="Small" Size="Sm" Variant="Outline" />
<ui:Toggle Text="Disabled" IsEnabled="False" /><ui:Toggle Icon="Star" />
<ui:Toggle Icon="Star" Text="Favourite" IsPressed="True" />
<ui:Toggle Text="Outline" Variant="Outline" />
<ui:Toggle Text="Small" Size="Sm" Variant="Outline" />
<ui:Toggle Text="Disabled" IsEnabled="False" />Not available on yet
API
| Property | Type | Default | Description |
|---|---|---|---|
IsPressed |
bool |
false |
Whether it's pressed. Two-way bindable. |
Text |
string |
— | Text shown by the component. |
Icon |
IconName |
None |
Lucide icon from IconName; None for no icon. |
Variant |
ToggleVariant |
Default |
Visual style. One of Default, Outline. |
Size |
ToggleSize |
Default |
Size preset. One of Sm, Default, Lg. |
| Event | Arguments | Description |
|---|---|---|
PressedChanged |
bool |
User input only: setting IsPressed from code or a binding doesn't raise it. |