Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Blocks
  2. App Shell
  3. API and Development

App Shell

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import AppShell, AppShellFit, AppShellRouteFocus from @prepared911/ui/blocks/app-shell. See props.ts for the props and schema.ts for the declaration (inputs and slots).
Props
PropTypeNotes
navbarReactElementRequired. A Navbar. Fixed.
mainReactNodeRequired. The page. Scrolls inside main.
skipLinkLabelLocalizedMessageRequired. Names the skip link.
sidebarReactElementA Sidebar at the inline-start edge. Fixed.
bannerReactElementOne Banner under the bar, across the full width.
dockReactNodeSpace reserved under main for the Dock.
fitAppShellFitViewport (default, 100dvh) or Container (the parent's block size).
routeKeystringIdentity of the current page.
routeFocusAppShellRouteFocusNone (default) or Main: where focus goes when routeKey changes.
routeAnnouncementLocalizedMessageName of the page, announced politely when it changes.
mainRefRef<HTMLElement>The main element, which is the scroll container.
mainIdstringId of main and the skip link's target. Generated when omitted.
mainDataAppShellMainDatadata-* attributes for main, such as the router's scroll restoration id.
className, ref, idOn the shell's root div.
data-*stringOn the shell's root div, such as data-test-id. A reserved state name is dropped, as Box does. main takes its own through mainData.
DOM
The main element is a raw element: Box renders main but removes tabIndex, and the skip link needs a target that script can focus. It takes a class, mainId, mainData and mainRef and nothing else.
Props (generated)
NameTypeDefaultDescription
mainReactNode—The page. It renders inside main, which scrolls on its own. In a TanStack Router app this is <Outlet />.
navbarReactElement<unknown, string | JSXElementConstructor<any>>—The application bar: a Navbar element. Its header is the page's banner landmark, so the shell places it outside main and outside any sectioning element. The bar stays fixed whatever main does.
skipLinkLabelLocalizedMessage—Name of the skip link, the first control in the tab order, which moves focus to main.
bannerReactElement<unknown, string | JSXElementConstructor<any>>—One Banner element directly under the bar, across the full width of the shell, above the sidebar as well. The slot takes a single element, so notices never stack.
classNamestring—@deprecated Pass layout through enum props and shipped parts. Request a missing case via find-pattern.
dockReactNode—Space the shell reserves for the Dock (CORE-1041), centered under main and never over it. Omit it and no space is reserved.
fitAppShellFitAppShellFit.ViewportWhat the shell's block size follows.
idstring—Id of the shell's root element.
mainDataAppShellMainData—data-* attributes for main. TanStack Router's element scroll restoration finds the container by data-scroll-restoration-id.
mainIdstring—Id of the main element, which is also the skip link's target. A generated id is used when omitted.
mainRefRef<HTMLElement>—Ref to the main element, which is the shell's scroll container.
refRef<HTMLDivElement>—Ref to the shell's root element.
routeAnnouncementLocalizedMessage—The name of the page the shell just showed. It is announced politely when it changes, so a screen reader hears the route change even though focus did not move. Pass the page title.
routeFocusAppShellRouteFocusAppShellRouteFocus.NoneWhere focus goes when routeKey changes.
routeKeystring—Identity of the current page, usually the pathname. When it changes after the first render the shell applies routeFocus. Leave it out for a shell that never changes page.
sidebarReactElement<unknown, string | JSXElementConstructor<any>>—The primary navigation: a Sidebar element. It sits at the inline-start edge, below the bar and the banner, and stays fixed; it scrolls its own content. Omit it and main takes the width.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
App Shell / Usage
Next
App Shell / Accessibility
On this page
Props
DOM
Props (generated)
Storybook