# Sidebar > An app sidebar with groups of items that collapses to a rail of icons. Source: https://native.shellui.dev/docs/components/navigation/sidebar ShellUI for Blazor's sidebar is a larger set of parts, so the preview below is built from HTML and the ShellUI tokens to match the native component. ## Installation ```bash shellui-native add sidebar ``` **Platforms:** MAUI · Avalonia. Also installs `icon`, `element-extensions`. ## Usage ### Basic **MAUI** ```xml ``` **Avalonia** ```xml ``` [Live preview](https://native.shellui.dev/preview/index.html?c=sidebar-basic) Put the sidebar in an `Auto` column next to your content. It is 256px wide; an item with a `Value` becomes the `SelectedValue` when pressed, and an item without one just raises `Clicked`. ### Collapsing `IsCollapsed` (or `Toggle()`) shrinks the sidebar to a 56px rail that shows the icons only, animating the width: ```csharp private void OnToggleSidebar(object? sender, EventArgs e) => AppSidebar.Toggle(); ``` The header and footer are your own views, so hide what doesn't fit the rail in `IsCollapsedChanged`. ### On phones A fixed column takes too much of a phone screen. Put the `Sidebar` inside a [Sheet](https://native.shellui.dev/docs/components/overlay/sheet.md) there and open it from a menu button. ## MAUI and Avalonia - On Avalonia the items are tab stops, pressed with Enter or Space. - On Avalonia the groups are collected in `Groups` and a group's items in `Items`. ## API ### Sidebar XAML children go to `Groups`. | Property | Type | Default | Description | |---|---|---|---| | `IsCollapsed` | `bool` | `false` | Shows the icon rail instead of the full sidebar. Two-way bindable. | | `SelectedValue` | `string` | — | The active item's `Value`. Two-way bindable. | | `ExpandedWidth` | `double` | `256` | Width when expanded. | | `CollapsedWidth` | `double` | `56` | Width of the icon rail. | | `Side` | `SidebarSide` | `Left` | Which edge of the window it sits on; the border is drawn on the other edge. One of `Left`, `Right`. | | `Header` | `View` (MAUI) · `Control?` (Avalonia) | `null` | A view above the groups. | | `Footer` | `View` (MAUI) · `Control?` (Avalonia) | `null` | A view below the groups. | | Event | Arguments | Description | |---|---|---| | `IsCollapsedChanged` | `bool` | The sidebar collapsed or expanded. | | `SelectedValueChanged` | `string?` | User input only: setting SelectedValue from code or a binding doesn't raise it. | | Method | Description | |---|---| | `Toggle()` | Collapses it if expanded, expands it if collapsed. | ### SidebarGroup XAML children go to `Items`. | Property | Type | Default | Description | |---|---|---|---| | `Label` | `string` | — | Heading above the group's items; hidden on the rail. | ### SidebarItem | Property | Type | Default | Description | |---|---|---|---| | `Text` | `string` | — | Item text; hidden on the rail. | | `Value` | `string` | — | Identifies the item; becomes the sidebar's `SelectedValue` when pressed. | | `Icon` | `IconName` | `None` | Lucide icon from `IconName`; `None` for no icon. | | `Badge` | `string` | — | Short text at the end of the row, e.g. a count. | | Event | Arguments | Description | |---|---|---| | `Clicked` | — | Clicked or tapped (or Enter / Space with keyboard focus). | | Method | Description | |---|---| | `Press()` | Picks the item in code, as a click or Enter/Space would. Avalonia only. |