Layouts
Jumbo React Next ships with six layout variants organized as Next.js route groups. Each variant
has its own layout.tsx, theme config, and layout options. Pages are automatically assigned to
a layout based on which route group they live in.
Layout variants
Common layout (default)
The (common) route group uses the full application shell with a persistent sidebar, fixed header,
and footer:
// src/app/[lang]/(common)/layout.tsx (simplified)
'use client';
import { JumboLayout, JumboLayoutProvider } from '@jumbo/components/JumboLayout';
import { defaultLayoutConfig } from '@/config/layouts/default';
import { Header } from '@/components/Header/Header';
import { Footer } from '@/components/Footer/Footer';
import { SidebarWithMenus } from '@/components/SidebarWithMenus/SidebarWithMenus';
import { CustomizerButton } from '@/components/CustomizerButton/CustomizerButton';
import { CustomizerSettings } from '@/components/CustomizerSettings/CustomizerSettings';
export default function CommonLayout({ children }) {
return (
<JumboLayoutProvider defaultLayoutConfig={defaultLayoutConfig}>
<JumboLayout header={<Header />} sidebar={<SidebarWithMenus />} footer={<Footer />}>
{children}
<CustomizerButton />
<CustomizerSettings />
</JumboLayout>
</JumboLayoutProvider>
);
}Demo layouts (Demo1–Demo4)
Each demo layout wraps JumboTheme with a demo-specific config and overrides the header
component and menu data. All four mirror the same page tree as (common) under their
/demo-1/, /demo-2/, /demo-3/, /demo-4/ URL prefixes.
| Layout | Header | Sidebar | Footer | Theme | Special feature |
|---|---|---|---|---|---|
| Demo 1 | Header1 (tall, 130px) | None | Visible | Light | No sidebar |
| Demo 2 | Header2 (90px) | Temporary, 240px | Visible | Light | Spread-out content |
| Demo 3 | Header3 (72px) | Temporary, 240px | Hidden | Light | Right sidebar enabled |
| Demo 4 | Header4 (72px) | Temporary, 240px | Hidden | Dark | HeroSection above content |
Demo layout file pattern
// src/app/[lang]/(demo4-layout)/layout.tsx (excerpt)
import { JumboTheme } from '@jumbo/components/JumboTheme';
import { JumboLayoutProvider } from '@jumbo/components/JumboLayout';
import { CONFIG4 } from '@/components/Demo4Layout/themes';
import { demoConfig4 } from '@/components/Demo4Layout/config';
import { Header4 } from '@/components/Demo4Layout/Header4/Header4';
import { HeroSection } from '@/components/Demo4Layout/HeroSection/HeroSection';
export default function Demo4Layout({ children }) {
return (
<JumboTheme init={CONFIG4.THEME}>
<JumboLayoutProvider defaultLayoutConfig={demoConfig4}>
<JumboLayout header={<Header4 />} sidebar={<SidebarWithMenus menus={demo4Menus} />}>
<HeroSection />
{children}
</JumboLayout>
</JumboLayoutProvider>
</JumboTheme>
);
}Solo layout
The (solo) group renders children without any application chrome. It is used for auth pages,
error pages, and the lock screen:
// src/app/[lang]/(solo)/layout.tsx
export default function SoloLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}Sub-layouts
Settings layout
User settings pages have an inner layout with a secondary sidebar menu:
/[lang]/user/settings/public-profile
/[lang]/user/settings/team
/[lang]/user/settings/notifications
...
The settings layout (src/app/[lang]/(common)/user/settings/layout.tsx) renders
SettingLayoutContent with links from src/services/setting-menu-services.ts.
App shells
Mail, Chat, and Contact use app-specific layouts that render their own sidebar panel alongside the page content:
| App | Layout file | Shell component |
|---|---|---|
apps/mail/layout.tsx | MailApp | |
| Chat | apps/chat/layout.tsx | ChatApp |
| Contact | apps/contact/layout.tsx | ContactApp |
These app shells are rendered inside the parent (common) or (demo*) layout, so the outer
sidebar and header remain visible.
Demo-specific menu data
Each demo layout sources its navigation from a different constants file:
| Layout | Menu source |
|---|---|
(common) | src/utilities/constants/menu-items.ts |
(demo1-layout) | src/utilities/constants/demo1-menus.ts |
(demo2-layout) | src/services/demo1-menu.ts (reuses Demo 1) |
(demo3-layout) | src/utilities/constants/demo3-menus.ts |
(demo4-layout) | src/utilities/constants/demo4-menus.ts |
Creating a custom layout
To add a new layout variant:
Create a new route group
Add a folder under
src/app/[lang]/with parentheses:bashmkdir -p src/app/\[lang\]/\(my-layout\)Create the layout.tsx
Add a
layout.tsxthat wrapsJumboLayoutProviderandJumboLayoutwith your config:tsx// src/app/[lang]/(my-layout)/layout.tsx 'use client'; import { JumboLayout, JumboLayoutProvider } from '@jumbo/components/JumboLayout'; import { myLayoutConfig } from '@/components/MyLayout/config'; import { MyHeader } from '@/components/MyLayout/MyHeader'; export default function MyLayout({ children }) { return ( <JumboLayoutProvider defaultLayoutConfig={myLayoutConfig}> <JumboLayout header={<MyHeader />}> {children} </JumboLayout> </JumboLayoutProvider> ); }Add pages
Create
page.tsxfiles inside the new route group. They will automatically use the new layout.
If your new layout needs a different color scheme, wrap JumboLayoutProvider in JumboTheme
with a custom JumboThemeConfig, following the pattern in (demo4-layout)/layout.tsx.