Tally UI

AppShell

AppShell frames the POS with an icon rail beside the page on wide windows and a slide-over drawer on phones.

Import

import { AppShell, RegisterBar, type ShellNavItem } from '@tallyui/components';

Usage

const navItems: ShellNavItem[] = [
  { id: 'pos', label: 'POS', icon: <PosIcon size={24} /> },
  { id: 'orders', label: 'Orders', icon: <OrdersIcon size={24} />, badge: 2 },
  { id: 'settings', label: 'Settings', icon: <SettingsIcon size={24} />, group: 'bottom' },
];

<AppShell
  navItems={navItems}
  activeId={route}
  onNavigate={(id) => router.navigate(`/${id}`)}
  registerBar={<RegisterBar {...barProps} storeName="Main St" />}
>
  <PosScreen />
</AppShell>

A window at least 768 wide and 480 tall gets the NavRail. Anything smaller, a phone on its side included, gets the NavDrawer, opened by the menu button that a RegisterBar inside the shell shows. Routing stays with the app: onNavigate receives the pressed item's id. The active item carries aria-current="page".

Props

PropTypeDefaultDescription
navItemsShellNavItem[]requiredNavigation entries: id, label, icon, optional badge, and group ('top' or 'bottom')
activeIdstring---The id of the current page's item
onNavigate(id: string) => voidrequiredCalled with the pressed item's id
registerBarReactNode---Drawn above the page, usually a RegisterBar
navFooterReactNode---Drawn at the foot of the rail on wide windows and of the drawer on phones, such as the app version
childrenReactNode---The page
classNamestring---Override root container styles
testIDstring'app-shell'Test identifier for the root

On this page