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.
Single vs Multi-Product Mode
Layout automatically switches between single and multi-product modes based on products array:
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:
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.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| children | React.ReactNode | Required | — | Page content to render within the layout |
| activeProductId | "website" | "payments" | "mobile-app" | Required | — | Current active product for logo and branding |
| products | Product[] | Optional | — | Product tabs for multi-product navigation |
| hamburgerMenuItems | HamburgerMenuItem[] | Optional | — | Hierarchical navigation menu items for hamburger menu. Supports New/Beta badges and generic notification badges on individual items. |
| schools | School[] | Required | — | Available schools for selection |
| selectedSchool | School | null | Required | — | Currently selected school |
| onSchoolChange | () => void | Required | — | Callback when school selector is clicked |
| previewLink | PreviewLink | null | Optional | — | Optional preview/store link in header |
| onHelpClick | () => void | Optional | — | Optional help button callback |
| accountMenuItems | AccountMenuItem[] | Optional | [] | Account dropdown menu items |
| dashboardHref | string | Optional | /dashboard | Dashboard/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
- • Payments Product - Full navigation system
- • CMS Product - Alternative product styling
- • Mobile App - Third product variant
What's Included
- • Complete header with all features
- • Hamburger menu navigation
- • Product switching capabilities
- • Responsive mobile design