Components
Shell
App frame that puts a Sidebar next to the main content area and shares the drawer state between them.
import { Shell, Sidebar } from "@openperf/deft";
<Shell.Root>
<Sidebar.Root>
<Sidebar.Content>
<Sidebar.Item href="/errors">Errors</Sidebar.Item>
</Sidebar.Content>
</Sidebar.Root>
<Shell.Main>{children}</Shell.Main>
</Shell.Root>;When to use
| Need | Component |
|---|---|
| Screen with a Sidebar | Shell |
| Screen without navigation: sign-in, onboarding, full-page error | Standalone |
Anatomy
<Shell.Root>
<Backdrop.Root /> {/* optional */}
<Sidebar.Root />
<Shell.Main>
<Shell.Bar /> {/* only on a page without a header of its own */}
{page}
</Shell.Main>
</Shell.Root>Shell.Root is a row at least as tall as the viewport. It wraps its children in Sidebar.Provider, so Sidebar.Root and every Sidebar.Trigger inside share the drawer state without a provider of your own. Shell.Main takes the remaining width and lays the page out as a column.
Small screens
Shell.Bar is visible only below 900px and holds a Sidebar.Trigger, so the sidebar can still be opened on a page that has no header. It takes no children. A page with a header puts Sidebar.Trigger there instead.
Page structure
| Page | Built from |
|---|---|
| Any page | A Breadcrumb as the title. |
| Settings page | A stack of Section components, each with a List or a Panel. |
| Detail page | A stack of Block components, each with a Data table, a Table or other data. |
Deft has no page container: add your own wrapper between Shell.Main and these parts to set the page width and gutters.
API
No part declares props of its own; each one passes native HTML attributes to its element. Shell.Bar accepts no children.