Skip to content
EspañolEnglish
All components (204)

App shell

Structure · AppShell · .amset-shell

What it is and when to use it

The shell of an application: header, side column, content and footer, in a CSS grid and in a single component: header, sider, children and footer.

When to use it

  • The frame of a management screen: TopBar on top, SideNav on the left and the content in the middle.

When not to

  • A public page or a landing page: there is no application column or header there.

What it gives without being asked: the content is a <main> with an id (mainId, content by default) and tabindex="-1" —the target of the TopBar "skip to content" link (skipTo)—, the header stays fixed (stickyHeader={false} to turn that off), and the side column stays fixed right below it (it measures its height) with its own scrolling if the menu is taller than the window.

Narrow screen (under 48 rem): the column moves above the content and stops being fixed, unless it is a SideNav: that one stays in its tile rail below 40 rem and remains next to the content, fixed and all the way down. A menu that hides behind a button needs its own panel (Drawer) and that is mounted outside.

Keyboard: Tab goes through the header, the column and the content, in that order. With a TopBar that has skipTo, the first Tab offers "Skip to content".

Fine-tuning: --amset-shell-sider-width (16 rem; also with the siderWidth prop) and --amset-shell-gap (content padding).

What it looks like

Skip to content
Aurelia Jewelry

orders

Order 1040

Awaiting shipment

Two rings and a pendant.

Order 1041

Awaiting shipment

Two rings and a pendant.

Order 1042

Awaiting shipment

Two rings and a pendant.

Order 1043

Awaiting shipment

Two rings and a pendant.

Order 1044

Awaiting shipment

Two rings and a pendant.

Order 1045

Awaiting shipment

Two rings and a pendant.

<AppShell
  header={<TopBar brand="Aurelia Jewelry" skipTo="contenido" actions={<Avatar name="Lucia Ferrer" size="sm" />} />}
  sider={
    <SideNav
      label="Main menu"
      sections={secciones}
      active={activo}
      onNavigate={(clave) => setActivo(clave)}
      collapsed={plegado}
      onCollapsedChange={setPlegado}
    />
  }
  siderWidth="auto"
  mainId="contenido"
>
  <Pedidos />
</AppShell>

Props

Import it with import { AppShell } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
childrenrequiredReactNodeThe content of the screen.
classNamestringMerged with the library classes; it does not replace them.
footerReactNodeThe footer of the page, under the content.
headerReactNodeThe top bar: normally a `TopBar`. It stays fixed when scrolling.
mainIdstringThe `id` of the main content. The "skip to content" link of the `TopBar` (`skipTo`) points to it. By default, `content`.
siderReactNodeThe left column: normally a `SideNav`. It stays fixed under the header.
siderWidthstringWidth of the left column. By default, that of `--amset-shell-sider-width` (16 rem).
stickyHeaderbooleanThe header stays stuck to the top when scrolling. Yes by default.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

CSS variables

These CSS variables are how you adapt it. Declare them on the component's selector, not on :root: the stylesheet redeclares them in the rule itself, and a declaration on the same element always wins.

VariableDefault
--amset-shell-sider-width16rem
--amset-shell-gapvar(--amset-space-6)

How to change it

.amset-shell {
  --amset-shell-sider-width: ...;
  --amset-shell-gap: ...;
}

In the test bench

Every state and variant, to try one at a time, on its page at ui.amset.tech: