Marigold
Marigold

Application

MarigoldProvider
RouterProvider

Layout

AppLayoutbeta
Aside
Aspect
Breakout
Center
Columns
Container
Grid
Inline
Inset
Scrollable
Split
Stack
Tiles

Actions

ActionBaralpha
Button
Link
LinkButton
ToggleButtonalpha
ToggleButtonGroupalpha

Form

Autocomplete
Calendarupdated
Checkbox
ComboBox
DateField
DatePicker
FileField
Form
Multiselectdeprecated
NumberField
Radio
SearchField
Select
Slider
Switch
TagFieldbeta
TextArea
TextField
TimeField

Collection

SelectList
Tableupdated
Tag

Navigation

Accordion
Breadcrumbs
Pagination
Sidebarbeta
Tabs
TopNavigationbeta

Overlay

ContextualHelp
Dialog
Drawer
Menu
Toastbeta
Tooltip

Content

Badge
Card
Divider
EmptyStatebeta
Headline
Icon
List
Loader
SectionMessage
SVG
Text

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
parseFormData
useAsyncListData
useListData
useResponsiveValue
useTheme
VisuallyHidden
Components

AppLayout

A CSS Grid container with three named areas sidebar, header, and main.

<AppLayout> is a CSS Grid container that divides the viewport into three areas: a full-height sidebar on the left, a fixed header on the top right, and a scrollable main area below the header. The grid fills 100dvh and only <AppLayout.Main> scrolls. The sidebar and header stay in place.

<AppLayout.Sidebar> renders a <Sidebar> internally and <AppLayout.Header> renders a <TopNavigation> internally, so you can place their sub-components directly without extra nesting.

Looking for composition guidance?

This page covers the component API. For a step-by-step guide on where to place content, how to wire up providers, and responsive strategy, see the App Shell pattern.

Usage

Basic structure

<AppLayout> provides three slot components. They can be placed in any order since the CSS Grid template handles positioning.

<Sidebar.Provider defaultOpen>
  <AppLayout>
    <AppLayout.Sidebar>
      <Sidebar.Header>{/* Logo */}</Sidebar.Header>
      <Sidebar.Nav>{/* Navigation items */}</Sidebar.Nav>
    </AppLayout.Sidebar>
    <AppLayout.Header>
      <TopNavigation.Start>{/* Toggle */}</TopNavigation.Start>
      <TopNavigation.Middle>{/* Breadcrumbs, search */}</TopNavigation.Middle>
      <TopNavigation.End>{/* User menu */}</TopNavigation.End>
    </AppLayout.Header>
    <AppLayout.Main>{/* Scrollable page content */}</AppLayout.Main>
  </AppLayout>
</Sidebar.Provider>
Logo
Navigation 1Navigation 2Navigation 3
Breadcrumbs
User Menu
Content item 1
Content item 2
Content item 3
Content item 4
Content item 5
import { AppLayout, Sidebar, TopNavigation } from '@marigold/components';export default () => (  <div className="h-[300px] [&>div]:!h-full">    <Sidebar.Provider defaultOpen>      <AppLayout>        <AppLayout.Sidebar>          <Sidebar.Header>            <span className="text-sm font-medium">Logo</span>          </Sidebar.Header>          <Sidebar.Nav>            <Sidebar.Item href="#">Navigation 1</Sidebar.Item>            <Sidebar.Item href="#">Navigation 2</Sidebar.Item>            <Sidebar.Item href="#">Navigation 3</Sidebar.Item>          </Sidebar.Nav>        </AppLayout.Sidebar>        <AppLayout.Header>          <TopNavigation.Start>            <Sidebar.Toggle />          </TopNavigation.Start>          <TopNavigation.Middle>            <span className="text-sm">Breadcrumbs</span>          </TopNavigation.Middle>          <TopNavigation.End>            <span className="text-sm">User Menu</span>          </TopNavigation.End>        </AppLayout.Header>        <AppLayout.Main>          <div className="space-y-2 p-4">            {Array.from({ length: 5 }, (_, i) => (              <div key={i} className="rounded-sm bg-stone-50 p-3 text-sm">                Content item {i + 1}              </div>            ))}          </div>        </AppLayout.Main>      </AppLayout>    </Sidebar.Provider>  </div>);

Sidebar.Provider

Sidebar.Provider manages the sidebar's open and collapsed state. Place it outside <AppLayout> so the sidebar toggle in the header and the sidebar itself share the same state.

Pass defaultOpen to start with the sidebar expanded. Without it, the sidebar starts collapsed. See the Sidebar docs for details on collapsing behavior, drill-down navigation, and keyboard shortcuts.

Scrolling

The header always stays visible, no matter how far users scroll. Only the content inside <AppLayout.Main> is scrollable. The sidebar also stays in place, but its navigation area scrolls independently when it has too many items. This is handled by the Sidebar component internally.

Don't
  • Don't nest <AppLayout> inside other layout containers
  • Don't put scrollable content in <AppLayout.Header>, use <AppLayout.Main> for that
  • Don't use <AppLayout> for simple pages that only need a header or only a sidebar

Accessibility

  • Landmarks: <AppLayout.Main> renders as <main>, providing a standard landmark region for screen readers. <AppLayout.Sidebar> renders an <aside> landmark automatically.
  • Scrollable region: The main area is scrollable and can be navigated with keyboard (arrow keys, Page Up/Down, Home/End)
  • Stacking order: The header uses z-index: 1 to ensure it stays above main content during scroll

Note

<AppLayout> is a structural layout component. Accessibility features like keyboard navigation, focus management, and ARIA attributes are provided by the components placed inside it. See Sidebar and TopNavigation for their accessibility details.

Props

Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
View AppLayout stories

AppLayout

Prop

Type

AppLayout.Sidebar

Prop

Type

AppLayout.Header

Prop

Type

AppLayout.Main

Prop

Type

Alternative components

  • Sidebar: Use standalone when you only need side navigation without a fixed header bar.

  • TopNavigation: Use standalone for a horizontal navigation bar without a sidebar.

  • Grid: Use for custom grid layouts that don't follow the L-shape pattern.

Last update: 2 minutes ago

RouterProvider

Provider for easier handling routing.

Aside

Component to separate content from the main content.

On this page

UsageBasic structureSidebar.ProviderScrollingAccessibilityPropsAppLayoutAppLayout.SidebarAppLayout.HeaderAppLayout.MainAlternative components