[!NOTE] Compound component — an opinionated composition of Helix primitives. Composes:
Sidebar,Header,Button,Collapsible.
Import
import { AppShell, AppShellTopBar, AppShellMode, AppShellHelp } from "@timelycare/helix-ui"
Usage
<AppShell
topBar={
<AppShellTopBar
logo={<Logo />}
notifications={<NotificationBell />}
userMenu={<UserMenu />}
/>
}
sidebar={
<AppSidebar
brand={<Logo />}
items={navItems}
activeItemId={currentRouteId}
onItemClick={(id) => router.push(routes[id])}
/>
}
>
<PageHeader title="Members" />
<DataTable columns={cols} data={rows} />
</AppShell>
Content width
Page content stops at 1280px (max-w-7xl), centred in the space beside the sidebar. The cap wraps the PageHeader and everything under it together, so the title, the toolbar and the table share one left edge, and a page never stretches across a large monitor. On a laptop or a 1920px monitor the cap barely engages; on a 2560px monitor the space past it splits evenly on both sides.
Don't add a max-w-* of your own to the page root to widen or re-centre the page. Narrower content keeps its own cap inside this one: a single-column form or settings page stops at max-w-2xl.
contentWidth="full" removes the cap, the p-6 inset and the gap between sections, so the page owns its edges. It is for a workspace that fills the viewport edge to edge, such as a live visit with its header, panes and side rail, never for a table that wants more room.
Closing the nav
A workspace can close the desktop nav while someone works in it, and reopen it on request: pass sidebarOpen and onSidebarOpenChange (or defaultSidebarOpen to leave the state to AppShell). Closed, the nav takes no width. Controls inside the page read and set it with useSidebar(). Ordinary pages keep the nav open; the workspace pattern is in helix-app-layouts.
Help button
Consumer apps and Provider float their help button at the bottom right (Admin and Campus put help in the sidebar instead; see helix-app-layouts). Pass help an AppShellHelp:
<AppShell topBar={…} sidebar={…} help={<AppShellHelp onClick={openHelp} />}>
It is provider's support button: 56px, round, primary, icon only, 24px from the corner. AppShell pins it over the page and deepens the page's bottom inset, so the last row of a table or a form's save bar can scroll out from under it. Don't position a button of your own: a fixed button with no inset sits on top of the last thing on the page.
The button is named by label, which is also its tooltip; the default is "Help". When it opens a panel, say which way it goes and swap the icon with it:
<AppShellHelp
label={chatOpen ? "Close support chat" : "Open support chat"}
icon={chatOpen ? <X /> : <MessageCircle />}
onClick={toggleChat}
/>
A full-width workspace (contentWidth="full") doesn't get the inset, because it lays out its own panes. Put help among its tools there, as provider's in-visit screen does with its Support tool.
Mode frame
When the whole app is in a special mode, say so round the whole app. TimelyCare staff emulating or viewing the app as another person is the case it was built for: everything looks like that person's app, and anything they change is real. Pass mode an AppShellMode, and a tone frame runs round all four sides of the app. The frame's top edge holds one sentence and the way out. The app sits inside with rounded corners.
<AppShell
topBar={<AppShellTopBar logo={<Logo />} userMenu={<UserMenu />} />}
sidebar={<AppSidebar items={navItems} pathname={pathname} />}
mode={
emulating ? (
<AppShellMode action={{ label: "Exit emulation", onClick: stopEmulating }}>
You're viewing as {member.name} ({member.role}). Changes you make are real.
</AppShellMode>
) : undefined
}
>
…
</AppShell>
- One sentence: what the mode is, then what it means for the person. "You're viewing as Riley Park (Campus admin). Changes you make are real." Plain text, with no links or buttons in it.
- Always a way out when the person can leave the mode:
action={{ label, onClick }}. Helix draws it as an outline button at the end of the bar. Helix doesn't move focus when it is pressed: once the frame is gone, move focus somewhere sensible, such as the page heading. - Tone:
warning(the default) when what the person does is real.infowhen nothing is saved, such as a preview. There is no red frame: a mode is not a failure.warningis Helix amber with dark text, not Campus orange: white on Campus orange fails AA. - Not a banner. A banner above the app scrolls away and reads like any other notice. The frame stays put while the page scrolls, and the sidebar and top bar sit inside it.
- Announced once. Screen readers hear the sentence once, politely, when the mode starts, and again only if it changes. Don't also show a toast or an
Alertfor it. - Phones: the frame narrows to 4px and the sentence wraps. It is never cut off.
- Your own sticky elements: while a mode is set, the bar's height is on the AppShell root as
--app-shell-mode-bar. Anything of yours that sticks to the top of the window needs to sit below it, and anything that sticks to the bottom (a sticky action bar) needsbottom-1 md:bottom-2so it clears the frame.