Bottom nav

The bottom navigation of a phone app (Material's navigation bar, the iOS tab bar): three to five destinations with an icon, a label and a badge, the current one marked by a pill. Links or a value; an action button in the middle; hides on scroll.

Source on GitHub

Patterns (tap the destinations; scroll the last one)
Homevalue · change
The pill, a count and a dot
Todaylabels="active" · indicator="line"
Five destinations, only the current label, a teal line
FeedThe + fires ray-select
variant="floating", an action in the middle, an avatar as icon
    hide-on-scroll (with an app bar that hides too)
    Code

    API

    For AI agents: this API as Markdown, or every component in llms-full.txt.

    <ray-bottom-nav>

    With href items it marks the link to this page (aria-current="page"); without, it is a control (value, change). Clear of the home indicator (safe-area inset). In a ray-app-shell, put it in the bottom slot.

    PropertyAttributeTypeDefaultDescription
    valuevalue reflectsstringThe current destination (an item's value, else its href, else its label).
    labellabelstringMain (text bottom-nav.label)Accessible name of the navigation.
    labelslabels reflectsalways | active | neveralwaysWhich labels show (the others stay for assistive technology).
    indicatorindicator reflectspill | line | nonepillHow the current destination is marked besides its color.
    colorcolor reflectsstringA palette color or any CSS color for the current item and the action (default: primary).
    variantvariant reflectsdefault | floatingdefaultdefault: a bar across the bottom; floating: a rounded bar off the edges.
    hideOnScrollhide-on-scroll reflectsbooleanSlides away while the content scrolls down, back on the way up.
    fixedfixed reflectsbooleanPinned to the bottom of the window (outside a shell).
    scrollTargetscroll-targetstringA selector of the element whose scrolling it follows (default: its shell's, else the window).
    EventDescription
    changeThe user picked another destination (read value).
    ray-selectAn action item was pressed.
    SlotDescription
    (default)ray-bottom-nav-item elements (3 to 5).
    PartDescription
    navThe <nav>.

    <ray-bottom-nav-item>

    A link with href, else a button. The badge is read with the label ("Messages, 3").

    PropertyAttributeTypeDefaultDescription
    valuevalue reflectsstringIts value (default: its href, else its label).
    labellabelstringThe label.
    iconiconstringAn icon of the registry, drawn filled on the current item when it has a filled version (or put one in the icon slot: yours, as it is).
    hrefhref reflectsstringMakes it a link.
    badgebadgestringA count or a short text on the icon.
    dotdot reflectsbooleanA dot on the icon (something new).
    activeactive reflectsbooleanSet by the bar: the current destination.
    disableddisabled reflectsbooleanNot interactive.
    actionaction reflectsbooleanA raised round button ("New"): it fires ray-select on the bar, it is not a destination.
    SlotDescription
    iconA custom icon (a ray-icon, an svg, an avatar).
    PartDescription
    itemThe link or button.
    indicatorThe pill behind the icon.
    badgeThe badge.
    labelThe label.

    Texts

    What it writes itself, in English; setStrings() translates them (Getting started: Languages).

    KeyEnglish
    bottom-nav.labelMain
    bottom-nav.badge{label}, {badge}
    bottom-nav.dot{label}, new