App Shell

The frame of an app-like page on a phone: a header that sticks to the top, the view's content, and a tab bar that sticks to the bottom. It is a column at least as tall as the screen (`100dvh`, so the browser's own bars coming and going never hide the tab…

navigationserver≥ 320pxuiv1.0.0

Preview

App Shell — live renderblocks-appshell--default ↗

Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.

Install

Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.

Via shadcn URL
npx shadcn@latest add https://ds.interlace.tools/r/app-shell.json
With the @interlace alias
npx shadcn@latest add @interlace/app-shell

History

This component is at v1.0.0, first shipped in @interlace/ui 2.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.

@interlace/ui 2.0.01 entry

  • Addedminor

    A mobile app shell. AppShell is the frame: a column at least 100dvh tall with a sticky header, a <main> (the SkipLink target) and a sticky tab bar, nothing fixed-position, so the last line of content always clears the bar and an on-screen keyboard never drags a bar into the page. TabBar holds three to five links with an icon and a word; the current one (currentHref, which keeps a parent tab current on its child pages) gets aria-current="page", a filled pill that grows in from the middle and a heavier label, and a tab can carry a count or a dot with words for assistive tech. hideFrom hides it where a Topbar takes over. AppHeader is the view's bar: back, title and actions, sticky, clear of the notch, with its surface only once content scrolls under it; largeTitle sets the title big and moves it into the bar on scroll, read once. AppHeaderBack is the back link, its arrow mirrored in RTL. Every part pads itself by env(safe-area-inset-*) for a page added to a home screen (viewport-fit=cover). Under reduced motion the pill, surface and title simply change.

Import

2 named exports — pull the parts you need.

Public API
import { AppShell, MIN_VIEWPORT } from '@/components/ui/patterns/app-shell';

Anatomy

Extracted from the primitive's JSDoc header. The source is the only documentation that can't drift.

<div data-slot="app-shell">
    {header}                         (AppHeader or Topbar)
    <main id="main" data-slot="app-shell-main">{children}</main>
    {tabBar}                         (TabBar)
  </div>

API reference

Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.

AppShellProps

Also accepts every <div> attribute.

PropTypeDescription
headerReact.ReactNodeThe top of the frame: an `AppHeader`, or a `Topbar` on wider screens.
tabBarReact.ReactNodeThe bottom of the frame: a `TabBar`.
mainIdstringThe id of `<main>`, the target of the page's SkipLink. @default 'main'
mainPropsOmit<React.ComponentProps<'main'>, 'id' | 'children'>Props for the `<main>` element.

Accessibility

Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.

What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.

Focus + keyboard behaviour
Native element semantics — no interaction layer to get wrong.
Focus ring (WCAG 2.2 SC 2.4.13)
Not focusable — no focus indicator required.
Reduced motion
No animation to gate.
ARIA in the source
None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.

Examples

1 more state from the same story file.

R-rule compliance

Every primitive in @interlace/ui models to the portable 26-rule floor enforced by the componentApi ESLint preset. The cells below pin exactly where each rule applies in this file.

RuleConceptWhere
R4Extends native el`React.ComponentProps<'div'>`
R6data-slot per partapp-shell, app-shell-main
R7className merged + rest`cn(BASE, className)` + `{...props}`
R14Declares min viewport`data-min-viewport` + exported const
R25Server componentlayout only
R26A11y from native elone `<main>`, a SkipLink target

Minimum viewport

This primitive declares MIN_VIEWPORT = 320 CSS px (DESIGN_PRINCIPLES #14). When mounted in a container narrower than this, the preflight contract draws a dev-mode outline so the regression is visible during local development.

Opt-in to the dev-mode warning
<body data-interlace-dev>...</body>

Add the data-interlace-dev attribute to the body in development builds only — preflight then outlines any primitive whose container is below its declared data-min-viewport.

Dependencies

Base UI primitive
Native / no Base UI dependency
Lucide icons
none
NPM dependencies
none

Source

The full implementation — components/ui/patterns/app-shell.tsx once installed.

89 lines · TypeScript
import * as React from 'react';

// @interlace/app-shell v1.0.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/app-shell
// What changed since: https://ds.interlace.tools/c/app-shell#history
// Generated banner — keep it, the upgrade diff reads this version.

/**
 * @interlace/ui — AppShell
 *
 * The frame of an app-like page on a phone: a header that sticks to the
 * top, the view's content, and a tab bar that sticks to the bottom. It is a
 * column at least as tall as the screen (`100dvh`, so the browser's own bars
 * coming and going never hide the tab bar), with a `<main>` that takes the
 * room between. Nothing in it is fixed-position, so the content's last line
 * always scrolls clear of the tab bar and an on-screen keyboard never drags
 * a bar into the middle of the page.
 *
 * ## Anatomy
 *

…69 more lines…

Registry JSON

The raw registry record — what the shadcn CLI fetches.