Skip to main content

Overview

The SidebarLayout component is the default layout for Tailor Platform applications. It provides:
  • Collapsible sidebar navigation
  • Responsive mobile menu
  • Dynamic breadcrumb navigation
  • Theme toggle button
  • Content outlet for page rendering
This component should be used as a direct child of AppShell.

Props

(props: { Outlet: () => React.ReactNode }) => React.ReactNode
Custom content renderer that receives an Outlet component for rendering page content.
React.ReactNode
Custom sidebar component. Defaults to DefaultSidebar.

Features

Responsive Behavior

  • Desktop: Sidebar is visible and collapsible
  • Mobile: Sidebar slides in as an overlay (offcanvas)
  • Icon Mode: Sidebar collapses to icon-only mode on narrow screens

Built-in Header

The header includes:
  • Sidebar toggle button (hidden when sidebar is open on desktop)
  • Dynamic breadcrumb navigation
  • Theme toggle button (light/dark mode)

Content Area

The content area automatically renders:
  • Page components from your route configuration
  • Custom content via the children render prop

Usage Examples

Basic Usage

Simplest setup with all defaults:

Custom Content Wrapper

Wrap page content with custom elements:

Custom Sidebar

Replace the default sidebar with your own:

Using DefaultSidebar with Custom Header/Footer

With Multiple Layout Sections

DefaultSidebar

The DefaultSidebar component provides auto-generated navigation from your module configuration.

Props

React.ReactNode
Custom header content displayed at the top of the sidebar
Custom footer content displayed at the bottom of the sidebar
React.ReactNode
When provided, enables explicit sidebar composition using SidebarItem, SidebarGroup, and other components. Auto-generation is completely disabled when children is specified.

Auto-generation Mode

By default, DefaultSidebar automatically generates navigation items based on your module/resource definitions:

Composition Mode

Manually define sidebar structure using components:
When using composition mode, you can use these components:

SidebarItem

Renders a navigation link with automatic active state and icon/title from page metadata.

SidebarGroup

Groups related navigation items together:

SidebarSeparator

Adds a visual divider between sidebar sections:

Customization

Theme Toggle

The theme toggle button is built-in and uses the useTheme hook:
The breadcrumb is dynamically generated from your current route. Customize breadcrumb titles using meta.breadcrumbTitle in your module/resource definitions:
Access sidebar state in custom components:

TypeScript

SidebarLayoutProps Type

DefaultSidebarProps Type

Styling

The sidebar uses Tailwind CSS with the astw: prefix. Customize the appearance by:
  1. Override CSS variables in your theme
  2. Apply custom classes to wrapper components
  3. Use the className prop on custom sidebar components

See Also