UI
App shell
Wrap an area of your app in the same sidebar dashboard layout the admin area uses.
AppShell draws a dashboard around a page: a sidebar, a navbar and a centred body. The
admin area uses it, and so can an area of your own. This page is for module authors who
build such an area. Set up the module first: Overview.
Use it in a layout
A layout reads its menus and passes them in. The Admin module's admin layout, simplified:
<AppShell
id="admin"
:title="t('title', 'Administration')"
home="/admin"
:navigation="navigation"
:nav-label="t('nav.label', 'Admin navigation')"
:search-groups="searchGroups"
:back-to="{ to: '/', label: t('backToSite', 'Back to the site') }"
>
<template #sidebar-footer="{ collapsed }">
<AccountMenu block :collapsed="collapsed" />
</template>
<slot />
</AppShell>
Other props are icon?, title, navLabel, searchLabel? and backTo?: { to, label, icon? }. The slots are
brand, sidebar-top and sidebar-footer (with { collapsed }), navbar-left, navbar-right and the default slot.
idnames thedashboard-sidebar-<id>cookie, which keeps the sidebar's width and collapse state. Give each area its own.homeandbackTo.toare raw paths. The shell adds the locale prefix.navigationis oneUNavigationMenulist per group. Atype: 'label'row heads a group.searchGroupsadds the ⌘K button and palette. Leave it out for no search.widemakes the body full width instead ofmax-w-7xl. A page can ask withdefinePageMeta({ wide: true }).
What the shell does for you
- Navbar. It shows "title › active section". The document title defaults to the active section; a page's own
useHeadwins. - Small screens. The navbar opens the sidebar as a drawer, which closes on navigation.
- Language. With more than one locale, the navbar shows the app's
LanguageSelect, unlessnavbar-rightis filled. - Scrolling. The shell's panel scrolls, not the document, so hash links work inside it.
- Theme. The light app theme is utility classes on the shell root. Restyle an area through
[data-area=app].
The rules for the area, such as one <h1> per page, are on
Layouts and navigation.