App shell
The page frame: a skip link, a header with its status and actions, an optional side column, the main region and a footer.
Previews are drawn in the theme you made.
Edit itHeader, main and footer #
import { AppShell, AppShellSlots, Badge, Button, Recipes } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
const Live = Recipes.Badge.style()
const Quiet = Recipes.Button.style({ tone: 'neutral', variant: 'outline' })
// The page's frame, with no state and no Message: a skip link, the header (the
// banner) with its status and actions, the main region and the footer. Shown
// in a box here; on a page it is the whole window, and its header stays in view.
export default example({
title: 'Header, main and footer',
slots: AppShellSlots,
recipe: Recipes.AppShell,
view: ({ style, h }) =>
h.div(
[h.Style({ blockSize: '22rem', overflow: 'auto', inlineSize: 'min(100%, 40rem)' })],
[
AppShell.view(
{
title: 'Acme',
status: [Badge.view({ text: 'Live', tone: 'live', style: Live }, h)],
actions: [Button.view({ label: 'Sign out', style: Quiet }, h)],
footer: [h.span([], ['Acme, 2026'])],
main: [h.h2([], ['Orders']), h.p([], ['Nothing is waiting for you.'])],
style,
},
h,
),
],
),
})In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.
A column at the end #
Getting started
Install: a few words on it.
Your first page: a few words on it.
Styling: a few words on it.
Deploying: a few words on it.
import { AppShell, AppShellSlots, Recipes } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
const SECTIONS = ['Install', 'Your first page', 'Styling', 'Deploying']
// `aside` is a column at the main region's end, an `aside` landmark named by
// `asideLabel`: here the page's contents. Below the theme's `md` breakpoint it
// follows the main region.
export default example({
title: 'A column at the end',
slots: AppShellSlots,
recipe: Recipes.AppShell,
view: ({ style, h }) =>
h.div(
[h.Style({ blockSize: '22rem', overflow: 'auto', inlineSize: 'min(100%, 40rem)' })],
[
AppShell.view(
{
title: 'Guide',
main: [
h.h2([], ['Getting started']),
...SECTIONS.map(section => h.p([], [`${section}: a few words on it.`])),
],
aside: [
h.ul(
[h.Style({ margin: '0', paddingInlineStart: '1rem' })],
SECTIONS.map(section => h.li([], [section])),
),
],
asideLabel: 'On this page',
style,
},
h,
),
],
),
})In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.
Configure once #
import { AppShell, AppShellSlots, Recipes } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
const Contained = Recipes.AppShell.style({ width: 'contained' })
// Every page's frame said once: the look and the skip link's words. A page
// passes only what is its own, its title and content.
const Frame = AppShell.configure({
base: { style: Contained, words: { skip: 'Go to the content' } },
})
export default example({
title: 'Configure once',
slots: AppShellSlots,
recipe: Recipes.AppShell,
view: ({ h }) =>
h.div(
[h.Style({ blockSize: '22rem', overflow: 'auto', inlineSize: 'min(100%, 40rem)' })],
[
Frame.view(
{
title: 'Settings',
main: [h.h2([], ['Account']), h.p([], ['Your name and email.'])],
},
h,
),
],
),
})In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.
Usage
Each example above is a module of its own, shown whole and run as shown, over the theme module Create a theme writes. The page hands it the style picked above.
Keyboard and accessibility
- The skip link comes first and shows only while focused; it targets the main region by id, which takes focus by script so Tab goes on from there.
- One landmark of each kind: the header is the banner,
mainthe main region and the footer the content info. The side column is a plain region, since aSidebarinside it is the navigation. - The brand mark is hidden from a screen reader (
aria-hidden); the title names the application.