Shell
Shell is the frame of an app, with a header, a rail, a sidebar, the content, an inspector and a bottom pane.
<Shell> <ShellHeader>…</ShellHeader> <ShellRail aria-label="Regions"> <ShellRailList> <ShellRailItem label="Files">{icon}</ShellRailItem> </ShellRailList> </ShellRail> <ShellSidebar aria-label="Sections"> <ShellPaneHeader float> <ShellTrigger target="sidebar" action="toggle" /> </ShellPaneHeader> <ShellScroll fade> <ShellNavGroup label="Workspace"> <ShellNavItem current>Home</ShellNavItem> </ShellNavGroup> </ShellScroll> <ShellPaneFooter>…</ShellPaneFooter> </ShellSidebar> <ShellContent>…</ShellContent> <ShellInspector aria-label="Details">…</ShellInspector> <ShellBottom aria-label="Console">…</ShellBottom></Shell>Use a Shell once, at the root of an app, to hold its frame: a full-width header, a narrow rail of icons, a sidebar, the main content, an inspector and a bottom pane. Include only the panes you need, and put your pages inside ShellContent.
Each pane places itself in the frame by its type, so you can write the panes in any order and that order stays the reading order. Every pane is a landmark: the header is a <header>, the rail and the sidebar are <nav> elements, the content is <main>, and the inspector and the bottom pane are <aside> elements.
Until someone opens or closes it, a pane follows the window size. The sidebar is open on a wide window and opens as an overlay on a narrow one, while the rail becomes a tab bar along the bottom. The inspector and the bottom pane start closed. CSS makes these choices, so the first paint is right before any script runs.
A ShellTrigger opens or closes a pane by name from anywhere in the frame. To hold a pane's state yourself, pass open and onOpenChange. Set resizable on the sidebar or the inspector to let people drag its edge to a new width.
By default the panes join edge to edge, with a single line between them. Set flush={false} on the side panes to float them over the content as separate panels, or on ShellContent to set the work area in from the frame as its own panel.
size on the Shell sets the size of the navigation rows, the rail items, the header rows and the padding in every pane, and each pane can set its own. A Shell fills the window by default, and contained makes it fill its parent instead, such as a card or a demo.
When a pane opens as an overlay, focus moves into it and the rest of the frame is unavailable until Escape, a press outside the pane or a ShellTrigger closes it.
Topics
Every symbol this component exports, grouped by the job it does. Each one carries the props it declares; each one has an anchor of its own.
The frame
Shell
Shell is the frame of an app, with a header, a rail, a sidebar, the content, an inspector and a bottom pane.
| Prop | Type | What it does |
|---|---|---|
contained? | boolean | Makes the shell fill its parent element instead of the window. |
size? | "1" | "2" | "3" | "4" | Sets the size step for the shell's panes and navigation. |
It also takes every prop of a <div>.
The panes
ShellNotice
A Notice about the whole app, in its own row above the header and across every column. It takes the Notice props, plus flush
| Prop | Type | What it does |
|---|---|---|
action? | React.ReactNode | One action that fixes the condition, such as "Get more usage". |
backdrop? | boolean | Set backdrop when content passes behind the notice, such as a scrolling region. |
children | React.ReactNode | The message, usually one sentence. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
dismissLabel? | string | The accessible name of the dismiss button. |
flush? | boolean | Joins the notice to the frame: square corners, edge to edge. |
icon? | React.ReactNode | An icon shown before the message. |
onDismiss? | () => void | Called when the person presses the ✕ dismiss button. |
size? | "1" | "2" | "3" | "4" | Sets the size of the notice: the padding, the corner, the text and the dismiss button. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | Sets the colour family, which tells the category of the message. |
ShellHeader
The bar across the top of the whole frame, rendered as a <header> landmark. For a header over the content only, put one inside ShellContent
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when content passes behind this pane, such as a canvas, a map or an image. |
flush? | boolean | Sets whether this pane joins the app frame. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the header: its padding, its row height and the controls in it. |
It also takes every prop of a <header>.
ShellSidebar
The wide navigation column, rendered as a <nav>. It is open on a wide window and opens as an overlay on a narrow one, unless you open or close it yourself
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when content passes behind this pane, such as a canvas, a map or an image. |
collapse? | "sheet" | "stack" | Sets what the sidebar becomes on a narrow window. |
defaultOpen? | boolean | Sets whether the pane starts open when you do not control it. |
defaultView? | "sidebar" | "content" | Sets the side a stacked sidebar shows first, when you don't control view. |
flush? | boolean | Sets whether this pane joins the app frame. |
maxWidth? | number | Sets the largest width, in CSS pixels, that a resize can give the pane. |
minWidth? | number | Sets the smallest width, in CSS pixels, that a resize can give the pane. |
onOpenChange? | (open: boolean) => void | Called when the user opens or closes the pane: with a trigger, the Escape key or a press on the scrim. |
onResize? | (width: number) => void | Called once when the user ends a resize, with the pane's new width. |
onViewChange? | (view: ShellStackView) => void | Called when a stacked sidebar changes side: with "content" when a ShellNavItem in it is pressed, and with "sidebar" when ShellBack is pressed. |
open? | boolean | Controls whether the pane is open. |
presentation? | "auto" | "fixed" | "overlay" | "bar" | Sets how the pane takes space when it is open. - auto, the default: in the layout on a wide window, and over the content on a narrow one. - fixed: always in the layout. - overlay: always over the content, with a scrim. |
resizable? | boolean | Lets the user drag the pane's edge to change its width. |
resizeLabel? | string | Sets the accessible name of the resize handle. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the pane: its padding, its rows and its buttons. |
view? | "sidebar" | "content" | Sets which side a sidebar that collapses into a stack shows on a narrow window. |
width? | number | Sets the pane's width in CSS pixels. |
It also takes every prop of a <nav>.
ShellContent
The work area, rendered as <main>, which fills the space the other panes leave. It scrolls inside the frame, except on a narrow touch screen, where the page itself scrolls
| Prop | Type | What it does |
|---|---|---|
flush? | boolean | Sets whether this pane joins the app frame. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the pane: its padding and the controls in it. |
It also takes every prop of a <main>.
ShellInspector
The details column at the end of the frame, rendered as an <aside>. It starts closed, unless you set defaultOpen
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when content passes behind this pane, such as a canvas, a map or an image. |
defaultOpen? | boolean | Sets whether the pane starts open when you do not control it. |
flush? | boolean | Sets whether this pane joins the app frame. |
maxWidth? | number | Sets the largest width, in CSS pixels, that a resize can give the pane. |
minWidth? | number | Sets the smallest width, in CSS pixels, that a resize can give the pane. |
onOpenChange? | (open: boolean) => void | Called when the user opens or closes the pane: with a trigger, the Escape key or a press on the scrim. |
onResize? | (width: number) => void | Called once when the user ends a resize, with the pane's new width. |
open? | boolean | Controls whether the pane is open. |
presentation? | "auto" | "fixed" | "overlay" | "bar" | Sets how the pane takes space when it is open. - auto, the default: in the layout on a wide window, and over the content on a narrow one. - fixed: always in the layout. - overlay: always over the content, with a scrim. |
resizable? | boolean | Lets the user drag the pane's edge to change its width. |
resizeLabel? | string | Sets the accessible name of the resize handle. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the pane: its padding, its rows and its buttons. |
width? | number | Sets the pane's width in CSS pixels. |
It also takes every prop of a <nav>.
ShellBottom
A full-width pane below the columns for a console or a log, rendered as an <aside>. It starts closed, unless you set defaultOpen
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when content passes behind this pane, such as a canvas, a map or an image. |
defaultOpen? | boolean | Sets whether the pane starts open when you do not control it. |
flush? | boolean | Sets whether this pane joins the app frame. |
height? | number | Sets the pane's height in CSS pixels. |
maxHeight? | number | Sets the largest height, in CSS pixels, that a resize can give the pane. |
minHeight? | number | Sets the smallest height, in CSS pixels, that a resize can give the pane. |
onOpenChange? | (open: boolean) => void | Called when the user opens or closes the pane: with a trigger, the Escape key or a press on the scrim. |
onResize? | (height: number) => void | Called once when the user ends a resize, with the pane's new height. |
open? | boolean | Controls whether the pane is open. |
presentation? | "auto" | "fixed" | "overlay" | "bar" | Sets how the pane takes space when it is open. - auto, the default: in the layout on a wide window, and over the content on a narrow one. - fixed: always in the layout. - overlay: always over the content, with a scrim. |
resizable? | boolean | Lets the user drag the pane's top edge to change its height. |
resizeLabel? | string | The handle's accessible name. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the pane: its padding and the controls in it. |
It also takes every prop of a <aside>.
The rail and the tab bar
ShellRail
The narrow column of icons for the app's top-level areas, rendered as a <nav>. On a narrow window it becomes a tab bar along the bottom. When a sidebar is present too, give each an aria-label
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when content passes behind this pane, such as a canvas, a map or an image. |
defaultOpen? | boolean | Sets whether the pane starts open when you do not control it. |
flush? | boolean | Sets whether this pane joins the app frame. |
onOpenChange? | (open: boolean) => void | Called when the user opens or closes the pane: with a trigger, the Escape key or a press on the scrim. |
open? | boolean | Controls whether the pane is open. |
presentation? | "auto" | "bar" | "rail" | "overlay" | Sets how the rail looks on a narrow window. - auto, the default: a rail on a wide window, and a tab bar along the bottom on a narrow one. - bar: a tab bar on a narrow window, and nothing on a wide one. - rail: never a tab bar. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the pane: its padding, its rows and its buttons. |
It also takes every prop of a <nav>.
ShellRailList
A group of rail items. A rail often has two, one for the app's areas at the top and one for account and settings at the bottom. In the tab bar, this group holds the places
It declares no props of its own. It takes every prop of a <div>.
ShellRailItem
One square in the rail, for one of the app's main areas. It shows only an icon, so give it a label, which screen readers announce and the tab bar shows under the icon
| Prop | Type | What it does |
|---|---|---|
aria-label? | string | Sets the item's name. |
current? | boolean | Marks the item as the current section. |
label? | string | Sets the item's name. |
render? | RenderElement | Renders the item as another element, such as a link: render={<a href="/inbox" />}. |
It also takes every prop of a <button>.
ShellRailAction
A control in the rail or tab bar that does something rather than going somewhere, such as opening search. In the tab bar it sits apart from the group of places, so it does not look like a destination
| Prop | Type | What it does |
|---|---|---|
label | string | Sets the button's name. |
render? | RenderElement | Renders the button as another element, such as a link, for an action that goes to a page. |
It also takes every prop of a <button>.
ShellTabBar
A tab bar for an app without a rail. On a narrow window it shows three to five places along the bottom, and on a wide window it shows nothing, because the sidebar holds the navigation. It is optional: without it, the sidebar opens as a drawer at every width
It declares no props of its own. What it takes arrives from a shared type or from the primitive it is built on.
Inside a pane
ShellScroll
The part of a pane that scrolls. The pane's other children stay in place, and this part fills the space that is left
| Prop | Type | What it does |
|---|---|---|
aria-label? | string | The accessible name of the scroll area. |
aria-labelledby? | string | The id of an element that names the scroll area, usually a heading above it. |
children? | React.ReactNode | The content that scrolls. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
fade? | boolean | Fades the content at each edge that has more content beyond it. |
focusable? | boolean | Whether keyboard users can tab to the scroll area. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
ShellPaneHeader
The band at the top of a pane. Its first row is a Toolbar, one control row tall at the pane's size, so it lines up with the rail and the app header beside it. Anything after the toolbar is a row under it, such as a filter or a time ruler. With float, the pane's content scrolls behind every row
| Prop | Type | What it does |
|---|---|---|
float? | boolean | Makes the row float over the pane's scrolling content, so the content passes behind it. |
It also takes every prop of a <div>.
Navigation rows
ShellNavGroup
A group of navigation rows under a heading. Screen readers announce the heading as the name of the group
| Prop | Type | What it does |
|---|---|---|
label? | React.ReactNode | The group's heading. |
It also takes every prop of a <div>.
ShellNavItem
One navigation row, as tall as a Button at the same size. Set current on the row for the page that is open
| Prop | Type | What it does |
|---|---|---|
current? | boolean | Marks the row as the current page. |
leading? | React.ReactNode | Sets the icon before the label. |
render? | RenderElement | Renders the row as another element, such as a link: render={<a href="/settings" />}. |
trailing? | React.ReactNode | Sets content after the label, at the far edge of the row, such as a count or a chevron. |
It also takes every prop of a <button>.
Opening and closing a pane
| Prop | Type | What it does |
|---|---|---|
action? | "toggle" | "open" | "close" | Sets what a press does to the target pane: toggle, open or close. |
render? | RenderElement | Renders the trigger as another element, usually a Kookie Button: <ShellTrigger target="sidebar" render={<Button iconOnly />} />. |
target | "rail" | "sidebar" | "inspector" | "bottom" | Which pane this button drives. |
It also takes every prop of a <button>.
- A
gapprop — The space around floating panes is one step of the theme's layout spacing, so it tightens and loosens with density. A custom number would fall out of step with the rest of the app. - A header position option — The
ShellHeaderalways spans the full width. For a header over the content only, put a header insideShellContent. - A narrow mode for the sidebar — A narrow column of icons is a rail, so use a
ShellRailbeside the sidebar. The two are separate panes that you can connect yourself. - Closing the sidebar together with the rail — Whether the two panes open and close together depends on the app, and many apps keep them independent. Use
ShellTriggeror controlled state to link them. - A half-open
peekstate — A pane is either open or closed. A half-open pane is complex to build and adds little, so it will wait until a real screen needs it. - An action on
ShellRailItem— A rail item goes to a place in the app. For a control that does something else, such as opening search, useShellRailAction, which sits beside the group of places in the tab bar. backdroponShellContent— Nothing ever sits behind the work area, so glass there would have nothing to show through. Put a Box or a Card withbackdropinside the content instead.- A tab bar built from the sidebar — A tab bar holds three to five items, while a sidebar is often much longer, so you choose what a phone shows by writing a
ShellTabBaror aShellRail. - A tab bar that changes what the sidebar shows — Each item in a tab bar goes to a place, so it takes a link rather than an
onClick. To change what a pane shows, use a rail. - A
presentationvalue for floating panes — A pane floats or stands apart when you setflush={false}, and the Shell works out which of the two you get from the other panes.