App shell
Lays out a header, sidebar, main content and footer for a whole app, with a skip link, and moves the sidebar into a drawer on narrow screens.
Example
<focsd-app-shell nav-label="Workspace"> <focsd-header slot="header" collapse-below="0" ><a href="#" slot="brand">Northwind</a></focsd-header > <focsd-sidebar slot="sidebar" label="Workspace"> <focsd-sidebar-item href="#" icon="menu" current>Projects</focsd-sidebar-item> <focsd-sidebar-item href="#" icon="search">Reports</focsd-sidebar-item> <focsd-sidebar-item href="#" icon="settings">Settings</focsd-sidebar-item> </focsd-sidebar> <h1>Projects</h1> <p>Twelve projects, three due this week.</p> <focsd-footer slot="footer"><p>© 2026 Northwind</p></focsd-footer></focsd-app-shell>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-app-shell.js';</script>
<focsd-app-shell nav-label="Workspace">…</focsd-app-shell>import { AppShell } from '@focsd-dev/react';
export function Example() { return <AppShell nav-label="Workspace">…</AppShell>;}<script setup>import '@focsd-dev/components/focsd-app-shell.js';</script>
<template> <focsd-app-shell nav-label="Workspace">…</focsd-app-shell></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-app-shell.js';
// template<focsd-app-shell nav-label="Workspace">…</focsd-app-shell><script> import '@focsd-dev/components/focsd-app-shell.js';</script>
<focsd-app-shell nav-label="Workspace">…</focsd-app-shell>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
collapse-below | collapseBelow | number | 768 |
nav-label | navLabel | string | — |
compact | compact | boolean | false |
Slots
| Slot | Description |
|---|---|
header | The page header, usually a focsd-header. |
sidebar | The navigation, usually a focsd-sidebar. It moves into the drawer when compact. |
(default) | The main content. |
footer | The page footer, usually a focsd-footer. |
CSS parts
Style the inside of the component with ::part(), for example focsd-app-shell::part(skip-link).
| Part | Description |
|---|---|
skip-link | The "Skip to main content" link, visible only while focused. |
grid | The grid holding header, sidebar, main and footer. |
header | The header row (menu button and header slot). |
sidebar | The sidebar column (wide only). |
main | The scrolling main region. |
footer | The footer row. |
nav-toggle | The menu button that opens the drawer (compact only). |
drawer | The navigation drawer, a modal dialog (compact only). |
drawer-close | The drawer's close button. |
Accessibility
- The shell renders the page's one
mainlandmark around its default slot; the header and footer keep their own banner and contentinfo landmarks, and the sidebar its navigation landmark. - The first Tab stop is a "Skip to main content" link, hidden until focused. It moves focus to
main. mainscrolls on its own while the header and footer stay put. It is a tab stop, so keyboard users can scroll it even when it holds no links.- Below
collapse-below(768 pixels by default) the sidebar moves into a modal dialog named bynav-label, opened by an "Open navigation" button before the header. Escape, the close button or following a link closes it, and focus returns to the button. - Put the content straight in the default slot: a
<main>inside the shell would be a second main landmark, and the shell warns about it in the console. - Right-to-left pages put the sidebar, and the drawer, on the right.
Keyboard
| Key | Action |
|---|---|
| Tab | The skip link first, then the header, sidebar, main and footer |
| Enter | On the skip link: move focus to the main content |
| Escape | Close the navigation drawer |
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.