Bottom Nav

A mobile tab bar with icon tabs, short labels, badges and an optional raised action button.

Next release

On the main branch of shellui-native; not in the 0.2.0-beta.1 CLI yet.

The phone take on a sidebar: a row of icon tabs pinned to the bottom of the screen, with count badges, dots and optionally a round action button in the middle. Put it in the last row of the page, or over the page so it can slide away while the page scrolls.

ShellUI for Blazor has no bottom nav, so the previews on this page are the Avalonia component itself, running in your browser. For whole screens built around one, see Blocks.

Installation

bash
shellui-native add bottom-nav

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

Usage

Basic

Avalonia, running in your browser
<ui:BottomNav SelectedValue="home" SelectedValueChanged="OnTabChanged">
    <ui:BottomNavItem Value="home" Icon="House" Text="Home" />
    <ui:BottomNavItem Value="inbox" Icon="Inbox" Text="Inbox" Badge="3" />
    <ui:BottomNavItem Icon="Plus" Text="New" Prominent="True" Clicked="OnNew" />
    <ui:BottomNavItem Value="search" Icon="Search" Text="Search" />
    <ui:BottomNavItem Value="me" Text="Me" Dot="True">
        <ui:BottomNavItem.IconContent>
            <ui:Avatar Fallback="SS" Size="Sm" />
        </ui:BottomNavItem.IconContent>
    </ui:BottomNavItem>
</ui:BottomNav>

SelectedValue is the active item's Value; pressing an item sets it. Badge puts a count over the icon ("3", "99+"), Dot a small dot for something new without a count, and IconContent replaces the icon with any view, such as an Avatar.

Prominent turns an item into a round action button, for compose or pay. In a full-width bar it rises above the bar's edge; in a floating bar it is just the circle. It raises Clicked and never becomes the selected item, so it needs no Value.

Variants

Variant sets the bar's style. Default (above) is a 64px bar with a border on top, where a line slides to the active item. Switching items animates in about 200 ms, and a press scales the icon in slightly. A badge on an active pill or circle takes its colour as its ring.

Pill

An 80px bar; a pill grows behind the active icon, as in Material 3. ActiveIcon swaps the icon while the item is active, here a ticked circle for Tasks.

Avalonia, running in your browser
<ui:BottomNav Variant="Pill" SelectedValue="tasks">
    <ui:BottomNavItem Value="tasks" Icon="Circle" ActiveIcon="CircleCheck" Text="Tasks" Badge="12" />
    <ui:BottomNavItem Value="inbox" Icon="Inbox" Text="Inbox" />
    <ui:BottomNavItem Value="calendar" Icon="Calendar" Text="Calendar" />
    <ui:BottomNavItem Value="settings" Icon="Settings" Text="Settings" />
</ui:BottomNav>

Floating

An inset rounded bar with a shadow; a filled pill slides behind the active icon, with the label under it, so long labels stay readable. With Labels="Active" only the active item shows its label and the others centre their icon.

Avalonia, running in your browser
<ui:BottomNav Variant="Floating" Labels="Active" SelectedValue="home">
    <ui:BottomNavItem Value="home" Icon="House" Text="Home" />
    <ui:BottomNavItem Value="inbox" Icon="Inbox" Text="Inbox" Badge="3" />
    <ui:BottomNavItem Value="messages" Icon="MessageCircle" Text="Messages" Dot="True" />
    <ui:BottomNavItem Value="profile" Icon="User" Text="Profile" />
</ui:BottomNav>

Lifted

The active icon rises into a ringed circle over the bar's top edge, and the circle slides from item to item. The bar always leaves room above it for the circle.

Avalonia, running in your browser
<ui:BottomNav Variant="Lifted" SelectedValue="home">
    <ui:BottomNavItem Value="home" Icon="House" Text="Home" />
    <ui:BottomNavItem Value="search" Icon="Search" Text="Search" />
    <ui:BottomNavItem Value="alerts" Icon="Bell" Text="Alerts" Badge="12" />
    <ui:BottomNavItem Value="profile" Icon="User" Text="Profile" />
</ui:BottomNav>

Expanding

A compact floating capsule of icons; the active one widens into a pill with its label. This variant always labels the active item only, whatever Labels says.

Avalonia, running in your browser
<ui:BottomNav Variant="Expanding" SelectedValue="home">
    <ui:BottomNavItem Value="home" Icon="House" Text="Home" />
    <ui:BottomNavItem Value="search" Icon="Search" Text="Search" />
    <ui:BottomNavItem Value="saved" Icon="Heart" Text="Saved" />
    <ui:BottomNavItem Value="profile" Icon="User" Text="Profile" />
</ui:BottomNav>

Labels

Labels picks which items show their label: Always (the default), Active (only the active item; the others centre their icon) or Never.

Colour and indicator

ActiveToken is the active item's colour in Default: Foreground unless you set it, Primary for a brand-coloured bar. ShowIndicator="False" drops the sliding line (Default) or pill (Floating), so the active item shows by colour alone.

xml
<ui:BottomNav ActiveToken="Primary" ShowIndicator="False">

Hiding while the page scrolls

Set ScrollSource to the page's scroll view and put the bar over the content, in the same cell and aligned to the bottom, so the content can use the space. Scrolling down slides the bar away (after 24px of scrolling, past the first 48px); scrolling up 8px or reaching the top brings it back. IsHidden is the same state, two-way: set it to hide or show the bar from code. Scroll the preview to try it.

Avalonia, running in your browser
<Grid>
    <ScrollView x:Name="Feed">
        <VerticalStackLayout Padding="16,16,16,120" Spacing="12">...</VerticalStackLayout>
    </ScrollView>
    <ui:BottomNav ScrollSource="{x:Reference Feed}" Variant="Floating" Labels="Active"
                  SelectedValue="feed" VerticalOptions="End">
        <ui:BottomNavItem Value="feed" Icon="House" Text="Feed" />
        <ui:BottomNavItem Value="search" Icon="Search" Text="Search" />
        <ui:BottomNavItem Value="saved" Icon="Bookmark" Text="Saved" />
        <ui:BottomNavItem Value="profile" Icon="User" Text="Profile" />
    </ui:BottomNav>
</Grid>

Leave room under the content (the bottom padding above), so the last item isn't stuck behind the bar when it is showing.

The home indicator

BottomInset is the space under the bar for the phone's home indicator: the full-width bars fill it with their colour, the floating ones sit above it. Left unset, it follows the safe area under the bar on phones and is 0 elsewhere, so set it only to override.

Events

SelectedValueChanged reports user input only: setting SelectedValue from code or a binding doesn't raise it. An item's Clicked fires on every press, also on the item that is already active, to scroll its page back to the top for example. Press() picks an item from code, as a tap would.

csharp
Tabs.SelectedValueChanged += (_, value) => ShowPage(value);
HomeTab.Clicked += (_, _) =>
{
    if (HomeTab.IsActive)
        ScrollHomeToTop();
};

MAUI and Avalonia

  • On Avalonia the items are tab stops: Enter or Space selects one, and Left and Right move to the neighbouring item and select it. On MAUI an item is selected with Enter or Space.
  • ScrollSource is a ScrollView on MAUI ({x:Reference Feed}) and a ScrollViewer on Avalonia ({Binding #Feed}).
  • IconContent is a View on MAUI and a Control on Avalonia. On MAUI it is the item's content property, so the view can also go straight inside <ui:BottomNavItem>.
  • BottomInset follows the safe area on Android and iOS on MAUI, and on Avalonia wherever the window draws edge to edge.

API

BottomNav

XAML children go to Items.

Property Type Default Description
SelectedValue string — The active item's Value. Two-way bindable.
Variant BottomNavVariant Default Visual style. One of Default, Pill, Floating, Lifted, Expanding.
Labels BottomNavLabels Always Which items show their label. Expanding always labels the active item only. One of Always, Active, Never.
ActiveToken ShellToken Foreground The active item's colour in Default (Primary for a brand-coloured bar).
ShowIndicator bool true The sliding line (Default) or pill (Floating); without it the active item shows by colour alone.
BottomInset double double.NaN Space under the bar for the home indicator: full-width bars fill it with their colour, floating ones sit above it. NaN follows the safe area under the bar on phones and is 0 elsewhere.
ScrollSource ScrollView (MAUI) · ScrollViewer? (Avalonia) null A scroll view to follow: scrolling it down hides the bar, scrolling up shows it.
IsHidden bool false Slid out of view, by ScrollSource or from code. Two-way bindable.
Event Arguments Description
SelectedValueChanged string? The user picked another item. Setting SelectedValue from code or a binding doesn't raise it.

BottomNavItem

XAML children go to IconContent.

Property Type Default Description
Text string — Label under the icon.
Value string — Identifies the item; becomes the bar's SelectedValue when pressed.
Icon IconName None Lucide icon from IconName; None for no icon.
ActiveIcon IconName None Shown instead of Icon while the item is active.
IconContent View (MAUI) · Control? (Avalonia) null Any view instead of the icon, such as an Avatar.
Badge string — A count over the icon ("3", "99+"). Empty hides it.
Dot bool false A small dot over the icon, for "something new" without a count.
Prominent bool false A round action button (compose, pay): it rises above a full-width bar, raises Clicked and never becomes the selected item.
Event Arguments Description
Clicked — Pressed, also when the item is already active (to scroll its page to the top, say).
Method Description
Press() Picks the item in code, as a tap or Enter/Space would.

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.