Bottom Nav
A tab bar fixed to the bottom of a phone screen, one icon and label per destination.
<arc-bottom-nav>Overview
BottomNav is a navigation bar fixed to the bottom of the viewport, for phones and other touch screens. Each item is an icon above a short label, for the three to five top-level destinations a mobile app usually has.
Pass the destinations as items ({ label, icon, value }) and the active one as value. Tapping an item sets value and fires arc-change with { value }, so your app can change the route.
Use TopBar on desktop and swap in BottomNav at mobile widths. The bar's backdrop blur keeps it legible over content scrolling underneath. For a second level of navigation, open a Drawer or Sheet from a BottomNav item.
Guidelines
Do
- Use three to five items. More crowd the bar on a small screen
- Give every item an icon people recognize and a label of one or two words
- Show it only at mobile widths, and use TopBar or Sidebar on desktop
- Set value to match the current route so the right item is highlighted
Don't
- Don't show BottomNav and TopBar navigation at the same time
- Don't use it for actions like "Create" or "Delete". It is for navigation only
Features
- Items are `<button>` elements, so Tab and Enter reach them. There are no arrow-key bindings
- The active item gets `aria-current="page"` and a glowing line under it
Preview
Usage
This component needs JavaScript. Use the Web Component or a framework wrapper.
<script type="module" src="@arclux/arc-ui"></script>
<arc-bottom-nav
value="home"
items='[
{ "label": "Home", "icon": "house", "value": "home" },
{ "label": "Search", "icon": "magnifying-glass", "value": "search" },
{ "label": "Profile", "icon": "user", "value": "profile" },
{ "label": "Settings", "icon": "gear", "value": "settings" }
]'
id="nav"
></arc-bottom-nav>
<script>
document.querySelector('#nav').addEventListener('arc-change', (e) => {
console.log('navigate:', e.detail.value);
});
</script>import { BottomNav } from '@arclux/arc-ui-react';
const items = [
{ label: 'Home', icon: 'home', value: 'home' },
{ label: 'Search', icon: 'search', value: 'search' },
{ label: 'Profile', icon: 'user', value: 'profile' },
{ label: 'Settings', icon: 'settings', value: 'settings' },
];
export function MobileNav() {
return (
<BottomNav
items={items}
value="home"
onArcChange={(e) => console.log('navigate:', e.detail.value)}
/>
);
}<script setup>
import { BottomNav } from '@arclux/arc-ui-vue';
const items = [
{ label: 'Home', icon: 'home', value: 'home' },
{ label: 'Search', icon: 'search', value: 'search' },
{ label: 'Profile', icon: 'user', value: 'profile' },
{ label: 'Settings', icon: 'settings', value: 'settings' },
];
function onChange(e) {
console.log('navigate:', e.detail.value);
}
</script>
<template>
<BottomNav :items="items" value="home" @arc-change="onChange" />
</template><script>
import { BottomNav } from '@arclux/arc-ui-svelte';
const items = [
{ label: 'Home', icon: 'home', value: 'home' },
{ label: 'Search', icon: 'search', value: 'search' },
{ label: 'Profile', icon: 'user', value: 'profile' },
{ label: 'Settings', icon: 'settings', value: 'settings' },
];
</script>
<BottomNav
{items}
value="home"
on:arc-change={(e) => console.log('navigate:', e.detail.value)}
/>import { Component } from '@angular/core';
import { BottomNav } from '@arclux/arc-ui-angular';
@Component({
imports: [BottomNav],
template: `
<arc-bottom-nav
[items]="items"
value="home"
(arc-change)="onChange($event)"
/>
`,
})
export class MobileNavComponent {
items = [
{ label: 'Home', icon: 'home', value: 'home' },
{ label: 'Search', icon: 'search', value: 'search' },
{ label: 'Profile', icon: 'user', value: 'profile' },
{ label: 'Settings', icon: 'settings', value: 'settings' },
];
onChange(e: CustomEvent) {
console.log('navigate:', e.detail.value);
}
}import { BottomNav } from '@arclux/arc-ui-solid';
const items = [
{ label: 'Home', icon: 'home', value: 'home' },
{ label: 'Search', icon: 'search', value: 'search' },
{ label: 'Profile', icon: 'user', value: 'profile' },
{ label: 'Settings', icon: 'settings', value: 'settings' },
];
export function MobileNav() {
return (
<BottomNav
items={items}
value="home"
onArcChange={(e) => console.log('navigate:', e.detail.value)}
/>
);
}import { BottomNav } from '@arclux/arc-ui-preact';
const items = [
{ label: 'Home', icon: 'home', value: 'home' },
{ label: 'Search', icon: 'search', value: 'search' },
{ label: 'Profile', icon: 'user', value: 'profile' },
{ label: 'Settings', icon: 'settings', value: 'settings' },
];
export function MobileNav() {
return (
<BottomNav
items={items}
value="home"
onArcChange={(e) => console.log('navigate:', e.detail.value)}
/>
);
}API
itemsArray<{label: string, icon?: string, value: string}>[]- Array of navigation items, each with a label, icon name, and value identifier.
valuestring''- The value of the currently active item. Controls which item is highlighted.
Events
arc-changedetail:{ value: string }- Fired when an item is tapped with detail: { value }.
See also
- Top BarThe header bar across the top of an app, with the brand on the left and user controls on the right.
- TabsA row of tab buttons that shows one of several panels at a time.
- Navigation MenuHorizontal navigation bar whose top-level items open dropdowns of links on hover or click. Each link can carry a one-line description.