Accordion
Stacked sections that expand and collapse, one or several at a time.
Installation
bash
shellui-native add accordion
Platforms: MAUI · Avalonia. Also installs element-extensions, accordion-item, accordion-trigger, accordion-content, icon.
Usage
Basic
Copy-and-own MAUI and Avalonia components with the ShellUI design.
Install the CLI, run shellui-native init, then add components.
Yes. Every colour is a theme token.
<ui:Accordion Type="Single" Value="what">
<ui:AccordionItem Value="what">
<ui:AccordionTrigger Text="What is ShellUI Native?" />
<ui:AccordionContent>
<ui:ShellLabel Text="Copy-and-own MAUI and Avalonia components with the ShellUI design." Size="Sm" />
</ui:AccordionContent>
</ui:AccordionItem>
<ui:AccordionItem Value="install">
<ui:AccordionTrigger Text="How do I install it?" />
<ui:AccordionContent>
<ui:ShellLabel Text="Install the CLI, run shellui-native init, then add components." Size="Sm" />
</ui:AccordionContent>
</ui:AccordionItem>
<ui:AccordionItem Value="dark">
<ui:AccordionTrigger Text="Does it support dark mode?" />
<ui:AccordionContent>
<ui:ShellLabel Text="Yes. Every colour is a theme token." Size="Sm" />
</ui:AccordionContent>
</ui:AccordionItem>
</ui:Accordion><ui:Accordion Type="Single" Value="what">
<ui:AccordionItem Value="what">
<ui:AccordionTrigger Text="What is ShellUI Native?" />
<ui:AccordionContent>
<ui:ShellLabel Text="Copy-and-own MAUI and Avalonia components with the ShellUI design." Size="Sm" />
</ui:AccordionContent>
</ui:AccordionItem>
<ui:AccordionItem Value="install">
<ui:AccordionTrigger Text="How do I install it?" />
<ui:AccordionContent>
<ui:ShellLabel Text="Install the CLI, run shellui-native init, then add components." Size="Sm" />
</ui:AccordionContent>
</ui:AccordionItem>
<ui:AccordionItem Value="dark">
<ui:AccordionTrigger Text="Does it support dark mode?" />
<ui:AccordionContent>
<ui:ShellLabel Text="Yes. Every colour is a theme token." Size="Sm" />
</ui:AccordionContent>
</ui:AccordionItem>
</ui:Accordion>Not available on yet
MAUI and Avalonia
On Avalonia the XAML children of AccordionItem are collected in Items. Otherwise the same.
API
Accordion
| Property | Type | Default | Description |
|---|---|---|---|
Type |
AccordionType |
Single |
Single (one open item) or Multiple. |
Value |
string |
— | Item open at first; comma-separated values with Type="Multiple". |
| Event | Arguments | Description |
|---|---|---|
ItemToggled |
(string Value, bool IsOpen) |
Fired when any item's open state changes: (value, isOpen). User input only: setting Value, or calling Toggle, from code doesn't raise it. |
| Method | Description |
|---|---|
IsOpen(string value) |
Whether the item with this value is open. |
Toggle(string value) |
Opens it if closed, closes it if open. |
AccordionItem
XAML children go to Items on Avalonia and Children on MAUI.
| Property | Type | Default | Description |
|---|---|---|---|
Value |
string |
— | Identifies the item within its accordion. |
| Event | Arguments | Description |
|---|---|---|
OpenChanged |
bool |
User input only, like the accordion's ItemToggled. |
| Method | Description |
|---|---|
Toggle() |
Opens it if closed, closes it if open. |
AccordionTrigger
XAML children go to Body.
| Property | Type | Default | Description |
|---|---|---|---|
Text |
string |
— | Text shown by the component. |
Body |
View (MAUI) · Control? (Avalonia) |
null |
Custom header content instead of Text. |
| Method | Description |
|---|---|
Activate() |
Does what pressing it does. |
ShellTriggerView.ActivateAncestor(Element from) |
Called by interactive children (Button) after they handle a click. |
AccordionContent
XAML children go to Content.
No properties of its own.