JumboLayout

JumboLayout is the core layout shell component of the @jumbo framework. It composes the header, sidebar, right sidebar, footer, and main content area, and reads all configuration from the nearest JumboLayoutProvider.

Import

typescript
import { JumboLayout, JumboLayoutProvider } from '@jumbo/components';

JumboLayoutProvider

Wrap your layout shell with JumboLayoutProvider to supply the initial layout configuration. Every layout variant in src/layouts/ follows this pattern.

Props

PropTypeRequiredDescription
layoutConfigLayoutOptionsYesInitial layout configuration object
debugOptions{ name: string }NoDevelopment helper — logs layout name
childrenReactNodeYesMust contain a JumboLayout

Usage

tsx
// src/layouts/StretchedLayout/StretchedLayout.tsx
import { JumboLayout, JumboLayoutProvider } from '@jumbo/components';
import { defaultLayoutConfig } from '@/config/layouts/default';
 
export function StretchedLayout() {
  return (
    <JumboLayoutProvider
      layoutConfig={defaultLayoutConfig}
      debugOptions={{ name: 'StretchedLayout' }}
    >
      <JumboLayout
        header={<Header />}
        footer={<Footer />}
        sidebar={<Sidebar menus={getMenus()} />}
      >
        <Outlet />
      </JumboLayout>
    </JumboLayoutProvider>
  );
}

JumboLayout

Renders the full layout frame using slots for each region.

Props

PropTypeRequiredDescription
headerReactNodeNoContent rendered in the header region
sidebarReactNodeNoContent rendered in the left sidebar
rightSidebarReactNodeNoContent rendered in the right sidebar
footerReactNodeNoContent rendered in the footer
childrenReactNodeYesMain content area; React Router <Outlet /> goes here

LayoutOptions type

Defined in @jumbo/types/JumboLayoutTypes.ts. Every key is optional unless marked.

typescript
interface LayoutOptions {
  header:       LayoutHeaderOptions;
  sidebar:      LayoutSidebarOptions;
  footer:       LayoutFooterOptions;
  rightSidebar?: LayoutRightSidebarOptions;
  content:      LayoutContentOptions;
  root:         LayoutRootOptions;
  wrapper:      LayoutWrapperOptions;
  main:         LayoutMainOptions;
}

LayoutSidebarOptions

KeyTypeDefaultDescription
openbooleantrueWhether the sidebar starts open
hidebooleanfalseRemoves the sidebar from the DOM entirely
variantSIDEBAR_VARIANTS'persistent'persistent, temporary, or permanent
styleSIDEBAR_STYLES'full-height'full-height or clipped-under-header
viewSIDEBAR_VIEWS'full'full (labels + icons) or mini (icons only)
anchorSIDEBAR_ANCHOR_POSITIONS'left'left, right, top, or bottom
widthnumber240Expanded width in pixels
minWidthnumber80Collapsed/mini width in pixels
drawerBreakpointMUI Breakpoint'xl'Below this breakpoint, sidebar becomes a drawer
scrollTypeSIDEBAR_SCROLL_TYPES'fixed'fixed or default scroll behavior

LayoutHeaderOptions

KeyTypeDefaultDescription
hidebooleanfalseRemoves the header
fixedbooleantrueSticks the header to the top
sx.heightnumber80Header height in pixels
spreadOutbooleanExtends header to full viewport width
drawerBreakpointMUI Breakpoint'xl'Breakpoint at which mobile drawer icon appears

LayoutFooterOptions

KeyTypeDefaultDescription
hidebooleanfalseRemoves the footer
spreadOutbooleanExtends footer to full viewport width

useJumboLayout hook

Read and update layout options at runtime from any child component:

typescript
import { useJumboLayout } from '@jumbo/components/JumboLayout';
 
export function SidebarToggleButton() {
  const { sidebarOptions, setSidebarOptions } = useJumboLayout();
 
  const toggleMini = () => {
    setSidebarOptions({
      ...sidebarOptions,
      view: sidebarOptions.view === 'mini'
        ? SIDEBAR_VIEWS.FULL
        : SIDEBAR_VIEWS.MINI,
    });
  };
 
  return <IconButton onClick={toggleMini} />;
}

Context values

ValueTypeDescription
layoutOptionsLayoutOptionsFull current layout options
sidebarOptionsLayoutSidebarOptionsSidebar section of current options
headerOptionsLayoutHeaderOptionsHeader section
footerOptionsLayoutFooterOptionsFooter section
contentOptionsLayoutContentOptionsContent section
setSidebarOptions(opts) => voidUpdate sidebar options
setHeaderOptions(opts) => voidUpdate header options
setFooterOptions(opts) => voidUpdate footer options
setOptions(opts) => voidReplace the entire layout config