GitHub

App Layout

Pre-configured layout patterns that combine sidebar, header, and content areas.

CMSPayload CMS Integration

App Layout components work seamlessly with CMS-managed navigation data, allowing content editors to configure sidebar navigation and header content.

CMS Demo

See how to integrate app layouts with CMS navigation:

Loading...
CMS ConfigurationSimulates Payload CMS layout configuration

Basic Usage

Loading...
App LayoutComplete application layout

Installation

The App Layout components are part of the UI package and use the Sidebar components internally.

pnpm add @corew500/ui

Usage

import {
  AppLayout,
  AppSidebar,
  AppHeader,
} from "@mordecai-design-system/ui"
<AppLayout
  sidebar={<AppSidebar nav={navItems} header={<Logo />} />}
  header={<AppHeader title="Dashboard" />}
>
  <YourPageContent />
</AppLayout>

Examples

Basic Layout

const navItems = [
  {
    title: "Main",
    items: [
      { title: "Dashboard", href: "/", icon: <HomeIcon /> },
      { title: "Settings", href: "/settings", icon: <SettingsIcon /> },
    ]
  }
]

<AppLayout
  sidebar={<AppSidebar nav={navItems} />}
  header={<AppHeader title="Dashboard" />}
>
  <DashboardContent />
</AppLayout>

With Header Actions

<AppLayout
  sidebar={<AppSidebar nav={navItems} />}
  header={
    <AppHeader
      title="Settings"
      right={<Button>Save</Button>}
    />
  }
>
  <SettingsForm />
</AppLayout>

Custom Sidebar Content

<AppLayout
  sidebar={
    <AppSidebar header={<Logo />} footer={<UserMenu />}>
      <CustomNavigation />
    </AppSidebar>
  }
>
  <Content />
</AppLayout>

Components

AppLayout

PropTypeDefaultDescription
sidebar*enum—Sidebar element (use AppSidebar or custom Sidebar)
headerenum—Header element (use AppHeader or custom header)
classNamestring—Additional className for the layout wrapper
contentClassNamestring—Additional className for the main content area
defaultOpenenumtrueDefault sidebar open state

AppSidebar

PropTypeDefaultDescription
navAppNavSection[]—Navigation sections
headerenum—Header content (logo, brand, etc.)
footerenum—Footer content (user menu, settings, etc.)
classNamestring—Additional className for the sidebar
renderLink(item: AppNavItem, children: ReactNode) => ReactNode—Render function for nav items (for custom Link components)

AppHeader

PropTypeDefaultDescription
titlestring—Page title
leftenum—Left side content (after sidebar trigger)
rightenum—Right side content
classNamestring—Additional className
showSidebarTriggerenumtrueShow the sidebar trigger button

Type Definitions

interface AppNavItem {
  title: string
  href: string
  icon?: ReactNode
  isActive?: boolean
  label?: string
}

interface AppNavSection {
  title: string
  items: AppNavItem[]
}

Related Components

For more control over layouts, use the underlying components: