AppShell
Responsive shell for your application with header and navbar
Import
Source
Docs
Package
Usage
AppShell is a layout component that can be used to create a common Header - Navbar - Footer - Aside - Content layout pattern. AppShell, Header, Footer, Aside and Navbar components include bare minimum default styles to simplify customization. View full source code
Responsive styles
Open responsive example in new tabAlt layout
To place Navbar and Aside components above Header and Footer, set layout="alt" on AppShell.
hidden prop
To hide all AppShell components and render only children set hidden prop:
Navbar and Aside components
Navbar and Aside components can be used outside of AppShell context (View full source code):
Navbar.Section and Aside.Section
Responsive width
Static position
To make Navbar or Aside static, set fixed={false}:
Custom scrollbars
Navbar.Section and Aside.Section components can be used with ScrollArea component (View full source code):
Semantic elements
- Header root element is
header - Navbar root element is
nav - Footer root element is
footer - Aside root element is
aside - AppShell wraps content with
maintag – !important do not usemaintag inside AppShell
AppShell component props
| Name | Type | Description |
|---|---|---|
| aside | ReactElement<any, string | JSXElementConstructor<any>> | <Aside /> component |
| asideOffsetBreakpoint | number | "xs" | "sm" | "md" | "lg" | "xl" | Breakpoint at which Aside component should no longer be offset with padding-right, applicable only for fixed position |
| children * | ReactNode | AppShell content |
| fixed | boolean | true to switch from static layout to fixed |
| footer | ReactElement<any, string | JSXElementConstructor<any>> | <Footer /> component |
| header | ReactElement<any, string | JSXElementConstructor<any>> | <Header /> component |
| hidden | boolean | true to hide all AppShell parts and render only children |
| layout | "default" | "alt" | Determines how Navbar and Aside components are positioned relative to Header and Footer components |
| navbar | ReactElement<any, string | JSXElementConstructor<any>> | <Navbar /> component |
| navbarOffsetBreakpoint | number | "xs" | "sm" | "md" | "lg" | "xl" | Breakpoint at which Navbar component should no longer be offset with padding-left, applicable only for fixed position |
| padding | number | "xs" | "sm" | "md" | "lg" | "xl" | Content padding |
| zIndex | ZIndex | zIndex prop passed to Navbar and Header components |
Navbar component props
| Name | Type | Description |
|---|---|---|
| children * | ReactNode | Navbar content |
| fixed | boolean | Set position to fixed |
| height | string | number | Component height |
| hidden | boolean | Set to true to hide component at hiddenBreakpoint |
| hiddenBreakpoint | number | "xs" | "sm" | "md" | "lg" | "xl" | Breakpoint at which component will be hidden if hidden prop is true |
| position | HorizontalSectionPosition | Position for fixed variant |
| width | Partial<Record<string, string | number>> | Component width with breakpoints |
| withBorder | boolean | Determines whether the element should have border |
| zIndex | ZIndex | z-index |
Header component props
| Name | Type | Description |
|---|---|---|
| children * | ReactNode | Header content |
| fixed | boolean | Changes position to fixed, controlled by AppShell component if rendered inside |
| height * | VerticalSectionHeight | Component height with breakpoints |
| position | VerticalSectionPosition | Control top, left, right or bottom position values, controlled by AppShell component if rendered inside |
| withBorder | boolean | Determines whether the element should have border |
| zIndex | ZIndex | z-index |
Aside component props
| Name | Type | Description |
|---|---|---|
| children * | ReactNode | Aside content |
| fixed | boolean | Set position to fixed |
| height | string | number | Component height |
| hidden | boolean | Set to true to hide component at hiddenBreakpoint |
| hiddenBreakpoint | number | "xs" | "sm" | "md" | "lg" | "xl" | Breakpoint at which component will be hidden if hidden prop is true |
| position | HorizontalSectionPosition | Position for fixed variant |
| width | Partial<Record<string, string | number>> | Component width with breakpoints |
| withBorder | boolean | Determines whether the element should have border |
| zIndex | ZIndex | z-index |
Footer component props
| Name | Type | Description |
|---|---|---|
| children * | ReactNode | Footer content |
| fixed | boolean | Changes position to fixed, controlled by AppShell component if rendered inside |
| height * | VerticalSectionHeight | Component height with breakpoints |
| position | VerticalSectionPosition | Control top, left, right or bottom position values, controlled by AppShell component if rendered inside |
| withBorder | boolean | Determines whether the element should have border |
| zIndex | ZIndex | z-index |
AppShell component Styles API
| Name | Static selector | Description |
|---|---|---|
| root | .mantine-AppShell-root | Root element, wraps Navbar, Header and content |
| body | .mantine-AppShell-body | AppShell body, contains Navbar and main element |
| main | .mantine-AppShell-main | AppShell main element, contains content |