Layouts React
The layouts are in resources/js/layouts. AppLayout and AuthLayout are wrappers that choose the real design at runtime, so a page never has to import a specific variant.
Layout selection flow
Setup → Layout (global default)
→ Settings → Layout (user override, not the auth layout)
→ LayoutService → shared `layout` prop
→ app.tsx picks AppLayout / AuthLayout by page name
→ AppLayout / AuthLayout render the chosen variant- On Setup → Layout, an admin picks the global defaults: app layout, sidebar variant, collapsible mode and auth layout.
- Each user can change their own app layout, sidebar variant and collapsible mode on Settings → Layout. They can't change the auth layout, which always follows the global default.
- The backend sends the result to the frontend as the
layoutprop (LayoutSettings). - In
app.tsx,auth/*pages getAuthLayout,settings/*pages get[AppLayout, SettingsLayout]and the rest getAppLayout(see Architecture → Overview).
For the backend side, read Navigation & layouts.
App layouts
app-layout.tsx accepts breadcrumbs?: BreadcrumbItem[] and, depending on layout.app_layout, renders one of two shells:
app_layout | Component | Structure |
|---|---|---|
sidebar (default) | app/app-sidebar-layout.tsx | AppSidebar + AppSidebarHeader (breadcrumbs) + content |
header | app/app-header-layout.tsx | AppHeader top navigation (menus + breadcrumbs) + content |
Each shell mounts the global ConfirmDialog. The sonner Toaster and TooltipProvider don't live here: app.tsx adds them once for every page in withApp.
The sidebar shell has two extra settings:
| Setting | Values | Default |
|---|---|---|
sidebar_variant | inset, sidebar, floating | inset |
sidebar_collapsible | icon, offcanvas, none | icon |
Normally the sidebar shows menus. As soon as the URL starts with /setup, it shows setupMenus instead.
The settings pages add one more layer. settings/layout.tsx draws the Profile / Security / Appearance / Layout sub-navigation inside the app shell and uses useCurrentUrl().isCurrentOrParentUrl to highlight the active item.
TIP
Want something on every app page, like a banner? Add it to both app-sidebar-layout.tsx and app-header-layout.tsx. If it should show on auth pages too, put it in withApp in app.tsx instead.
Auth layouts
auth-layout.tsx takes title and description as translation keys and translates them itself. Which of the three designs it renders depends on layout.auth_layout:
auth_layout | Component | Look |
|---|---|---|
card (default) | auth/auth-card-layout.tsx | Logo above a centred card on a muted background |
simple | auth/auth-simple-layout.tsx | Logo, title and form on a plain background |
split | auth/auth-split-layout.tsx | Dark left panel with logo and app name, form on the right |
Per-page layout override
Each page can control its layout with a static layout property:
| Goal | Set Page.layout to | Used by |
|---|---|---|
| Pass props to the default layout | An object: { breadcrumbs } or { title, description } | Most pages |
| Change layout props at runtime | Call setLayoutProps({...}) in an effect | two-factor-challenge.tsx, accept-invitation.tsx |
| No layout (full screen) | [] as never[] | home.tsx, auth/maintenance.tsx, auth/suspended.tsx |
| Pick a layout from props | A function returning a layout | errors/error.tsx |
This is how an app page sets its breadcrumbs. The titles are translation keys, and breadcrumbs.tsx translates them:
UsersIndex.layout = {
breadcrumbs: [
{ title: 'modules.common.nav.dashboard', href: dashboard() },
{ title: 'modules.user.breadcrumbs.users', href: index() },
],
};View other override examples
Setting the title and description on an auth page:
Login.layout = {
title: 'modules.auth.login.title',
description: 'modules.auth.login.description',
};Changing the title at runtime with setLayoutProps. When the user switches to a recovery code, two-factor-challenge.tsx swaps the title. accept-invitation.tsx does the same thing when mode === 'user', so the wording fits a user invitation.
import { setLayoutProps } from '@inertiajs/react';
useEffect(() => {
setLayoutProps({
title: authConfigContent.title,
description: authConfigContent.description,
});
}, [authConfigContent.title, authConfigContent.description]);Turning the layout off:
Home.layout = [] as never[];Choosing the layout per request. Signed-in users see the error page in the app shell, while guests get the auth layout:
import AppLayout from '@/layouts/app-layout';
import AuthLayout from '@/layouts/auth-layout';
ErrorPage.layout = (props: PageProps) =>
props.auth.user ? AppLayout : AuthLayout;View layouts folder
layouts/
├── app-layout.tsx # chooses app/app-sidebar-layout.tsx or app/app-header-layout.tsx
├── auth-layout.tsx # chooses auth/auth-card-layout.tsx, auth-simple-layout.tsx or auth-split-layout.tsx
├── app/
│ ├── app-sidebar-layout.tsx
│ └── app-header-layout.tsx
├── auth/
│ ├── auth-card-layout.tsx
│ ├── auth-simple-layout.tsx
│ └── auth-split-layout.tsx
└── settings/layout.tsx # Profile / Security / Appearance / Layout sub-navigation