Layout Component

The complete layout system that provides the structural foundation for all application pages. Includes header, navigation, and content areas in a single, easy-to-use component.

Layout

Complete page layout wrapper that combines header with logo and account menu, hamburger navigation, and content area. This is the only component you need to wrap your pages.

🚀 Interactive Layout Demo

Experience the complete Layout component with all features, live controls, and mock data in a dedicated full-screen environment.

Full Layout
Complete header + navigation
Live Controls
Adjust props in real-time
Mock Data
No API dependencies
Launch Interactive Demo
Single vs Multi-Product Mode

Layout automatically switches between single and multi-product modes based on products array:

0-1 tabs:Single product mode - No tabs shown in header, clean single-product interface
2+ tabs:Multi-product mode - Product tabs appear in header for switching between products

This affects both the topbar (shows/hides product tabs) and hamburger menu (shows/hides product switching options).

Navigation Badge System

Hamburger menu items support three types of badges that can be displayed simultaneously:

"New" Badge:Purple-pink gradient with sparkles icon (shouldDisplayNewBadge: true)
"Beta" Badge:Blue pill-style badge for features in beta (shouldDisplayBetaBadge: true)
Generic Badge:Numeric or string badge for counts/notifications (badge: number | string)

All three badge types can coexist on a single menu item. They're positioned to the right of the menu item label and automatically handle layout.

PropTypeRequiredDefaultDescription
childrenReact.ReactNodeRequired—Page content to render within the layout
activeProductId"website" | "payments" | "mobile-app"Required—Current active product for logo and branding
productsProduct[]Optional—Product tabs for multi-product navigation
hamburgerMenuItemsHamburgerMenuItem[]Optional—Hierarchical navigation menu items for hamburger menu. Supports New/Beta badges and generic notification badges on individual items.
schoolsSchool[]Required—Available schools for selection
selectedSchoolSchool | nullRequired—Currently selected school
onSchoolChange() => voidRequired—Callback when school selector is clicked
previewLinkPreviewLink | nullOptional—Optional preview/store link in header
onHelpClick() => voidOptional—Optional help button callback
accountMenuItemsAccountMenuItem[]Optional[]Account dropdown menu items
dashboardHrefstringOptional/dashboardDashboard/home link URL

Type Definitions

Product

Product tab configuration for multi-product header

interface Product {
  id: string
  label: string
  href?: string
  icon?: React.ComponentType<{ className?: string }>
  isActive?: boolean
  onClick?: () => void
}
HamburgerMenuItem

Hierarchical navigation menu item structure with badge support

interface HamburgerMenuItem {
                key: string
                type: 'link' | 'subnav'
                name: string
                description?: string
                href: string | null
                icon: string
                sort_order?: number
                items: HamburgerMenuItem[]
                badge?: string | number
                shouldDisplayNewBadge?: boolean
                shouldDisplayBetaBadge?: boolean
                isActive?: boolean
              }
School

School selection dropdown item

interface School {
  id: string
  name: string
}
PreviewLink

Optional preview/store link in header

interface PreviewLink {
  href: string
  label: string
  icon: string
}
AccountMenuItem

Account dropdown menu item configuration

interface AccountMenuItem {
  label: string
  icon: string
  onClick: () => void
}

Complete Layout Usage

import { Layout } from '@/components/shared/layout'

export default function MyPage() {
  return (
    <Layout
      activeProductId="payments"
      products={products}
      hamburgerMenuItems={hamburgerMenuItems}
      schools={schools}
      selectedSchool={selectedSchool}
      onSchoolChange={handleSchoolChange}
      previewLink={previewLink}
      onHelpClick={handleHelpClick}
      accountMenuItems={accountMenuItems}
      dashboardHref="/dashboard"
    >
      <div className="p-8">
        <h1>Your Page Content</h1>
        <p>Everything is automatically wrapped with header and navigation.</p>
      </div>
    </Layout>
  )
}

Badge System Examples

// Example 1: "New" badge for newly released features
const menuItemWithNewBadge: HamburgerMenuItem = {
  key: 'plan',
  type: 'link',
  name: 'Plan',
  href: '/cms/plan',
  icon: 'calendar',
  items: [],
  shouldDisplayNewBadge: true  // Shows purple-pink gradient "New" badge
}

// Example 2: "Beta" badge for features in testing
const menuItemWithBetaBadge: HamburgerMenuItem = {
  key: 'forms-builder',
  type: 'link',
  name: 'Forms Builder',
  href: '/cms/forms',
  icon: 'clipboard',
  items: [],
  shouldDisplayBetaBadge: true  // Shows blue pill "Beta" badge
}

// Example 3: Generic numeric badge for notifications
const menuItemWithCountBadge: HamburgerMenuItem = {
  key: 'accessibility',
  type: 'link',
  name: 'Accessibility',
  href: '/cms/accessibility',
  icon: 'universal-access',
  items: [],
  badge: 3  // Shows numeric badge (can also be string)
}

// Example 4: Multiple badges on the same item
const menuItemWithMultipleBadges: HamburgerMenuItem = {
  key: 'supplies',
  type: 'subnav',
  name: 'Supplies',
  href: null,
  icon: 'shopping-cart',
  items: [],
  shouldDisplayNewBadge: true,    // "New" badge
  shouldDisplayBetaBadge: true,   // "Beta" badge
  badge: 5                        // Generic count badge
  // All three badges display simultaneously
}

// Example 5: Navigation with mixed badge types
const hamburgerMenuItems: HamburgerMenuItem[] = [
  {
    key: 'dashboard',
    type: 'link',
    name: 'Dashboard',
    href: '/cms/dashboard',
    icon: 'home',
    items: []
  },
  menuItemWithNewBadge,
  menuItemWithBetaBadge,
  {
    key: 'content',
    type: 'subnav',
    name: 'Content',
    href: null,
    icon: 'file-text',
    items: [
      {
        key: 'pages',
        type: 'link',
        name: 'Pages',
        href: '/cms/pages',
        icon: 'file',
        items: [],
        badge: 12  // Badge on submenu item
      }
    ]
  }
]
Badge Usage Guidelines

New Badge: Use for recently launched features or sections that users should discover. Typically removed after 30-60 days or when adoption metrics are met.

Beta Badge: Use for features in testing or early access. Signals to users that the feature is functional but may have limitations or changes coming.

Generic Badge: Use for dynamic counts, notifications, or status indicators. Can display numbers (unread items, pending tasks) or short strings.

Note: Badges are purely visual indicators and do not affect navigation functionality. They are positioned automatically and handle responsive layout.

What You Get
Automatic Features:
  • • Header with logo and branding
  • • School selector dropdown
  • • Account menu with actions
  • • Hamburger navigation menu
  • • Badge system (New/Beta/Notification)
No Setup Required:
  • • Navigation state management
  • • Mobile responsiveness
  • • Consistent spacing and typography
  • • Cross-browser compatibility

Ready to Use Layout

The Layout component is production-ready and used across all Edlio products. Simply wrap your pages and you get the complete navigation experience.

Implementation Examples

What's Included

  • • Complete header with all features
  • • Hamburger menu navigation
  • • Product switching capabilities
  • • Responsive mobile design