.claude/skills/build-app-layout/SKILL.md
Use this skill for any task involving app layouts — building new layouts, adding sidebars or navigation to existing apps, migrating an existing layout to mui-treasury components, or reviewing/improving layout structure. Trigger whenever the user mentions dashboard layout, sidebar navigation, app shell, header/footer/content structure, collapsible sidebar, drawer navigation, layout with sidebar, or asks to "build a layout", "add a sidebar", "set up the app layout", "review the layout". Also trigger when a mockup or design shows an app with sidebar + header + content regions, even if the user doesn't say "layout" explicitly.
npx skillsauth add siriwatknp/mui-treasury build-app-layoutInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Components are installed via the mui-treasury CLI into src/mui-treasury/:
# Layout core (Root, Header, Content, Footer, EdgeSidebar, InsetSidebar, etc.)
npx mui-treasury@latest add layout-core
# Sidebar primitives (SidebarContainer, SidebarMenuButton, SidebarIcon, etc.)
npx mui-treasury@latest add sidebar
After installation, import from:
@/mui-treasury/layout/layout-core — layout components@/mui-treasury/components/sidebar — sidebar primitivesUse these as starting values unless the user specifies otherwise.
collapsedWidth: "52px"SidebarIcon shrinkSize="20px" to center icons in the collapsed sidebarpermanentAutoCollapse="lg" to auto-collapse below the lg breakpoint<EdgeSidebarCollapser render={<SidebarRail />} /> as a click-to-collapse trigger — SidebarRail is a pure visual component, EdgeSidebarCollapser injects the collapse onClickEdgeSidebarCollapserCollapsibleIconPlace SidebarContainer in the middle of EdgeSidebarContent so it grows to fill available space and becomes the scrollable area for menus. Static-height content (sidebar header/footer) should be siblings of SidebarContainer:
EdgeSidebarContent
├── Sidebar header (static) — e.g. app switcher, logged-in user, logo
├── SidebarContainer (flex: 1, scrollable) — navigation menus
└── Sidebar footer (static) — e.g. user preferences, settings, ads/banner
EdgeSidebarContent uses display: flex; flex-direction: column by defaultSidebarContainer grows via flex: 1 and handles its own overflow scrollSidebarMenuButton, SidebarIcon, etc.) still work in the header/footer areas because they are descendants of EdgeSidebar — but collapse-aware CSS variables (--_collapsed/--_uncollapsed) only work inside SidebarContainershould use the component prop for polymorphism, e.g. <SidebarMenuButton component="a" href="/dashboard"> or <SidebarMenuButton component={Link} to="/dashboard">
MUST be a child of SidebarMenuItem which is a child of SidebarMenuList. Never wrap SidebarMenuButton in a plain div or Box — the list structure (SidebarMenuList > SidebarMenuItem > SidebarMenuButton) is required for proper spacing, collapse behavior, and accessibility
Never use consecutive SidebarText siblings inside a SidebarMenuButton. For multi-line text, use a single SidebarText wrapping the content. For two-line text labels, use SidebarGroupText:
// ❌ Wrong — consecutive SidebarText
<SidebarMenuButton>
<Avatar />
<SidebarText><Typography>siriwatknp</Typography></SidebarText>
<SidebarText><Typography>[email protected]</Typography></SidebarText>
</SidebarMenuButton>
// ✅ Correct — single SidebarText with SidebarGroupText for 2 lines
<SidebarMenuButton>
<Avatar />
<SidebarText>
<SidebarGroupText>
<Typography variant="body2">siriwatknp</Typography>
<Typography variant="caption">[email protected]</Typography>
</SidebarGroupText>
</SidebarText>
</SidebarMenuButton>
Never place secondary actions (e.g. IconButton, Badge) inside SidebarMenuButton. Use SidebarMenuAction as a sibling:
// ❌ Wrong — actions inside SidebarMenuButton
<SidebarMenuItem>
<SidebarMenuButton>
<Avatar />
<SidebarText>siriwatknp</SidebarText>
<Box sx={{ display: "flex", gap: 0.5 }}>
<IconButton size="small"><MoreHorizRounded /></IconButton>
<IconButton size="small"><NotificationsRounded /></IconButton>
</Box>
</SidebarMenuButton>
</SidebarMenuItem>
// ✅ Correct — SidebarMenuAction as sibling
<SidebarMenuItem>
<SidebarMenuButton>
<Avatar />
<SidebarText>siriwatknp</SidebarText>
</SidebarMenuButton>
<SidebarMenuAction>
<IconButton size="small"><MoreHorizRounded /></IconButton>
<IconButton size="small"><NotificationsRounded /></IconButton>
</SidebarMenuAction>
</SidebarMenuItem>
Never make SidebarMenuButton non-interactive (e.g. component="div" with cursor: "default"). If the element is not clickable, use SidebarMenuItem directly instead:
// ❌ Wrong — non-interactive button
<SidebarMenuButton component="div" sx={{ cursor: "default", "&:hover": { bgcolor: "transparent" } }}>
<Avatar />
<SidebarText>siriwatknp</SidebarText>
</SidebarMenuButton>
// ✅ Correct — use SidebarMenuItem for non-interactive content
<SidebarMenuItem>
<Avatar />
<SidebarText>siriwatknp</SidebarText>
</SidebarMenuItem>
SidebarMenuAction must only be used alongside a SidebarMenuButton sibling. If there is no SidebarMenuButton, use a plain IconButton instead
hoverUncollapse with EdgeSidebarRail — they are noy designed to work together and can cause janky behaviorhoverUncollapse with SidebarTooltip — tooltips won't show when the sidebar is collapsed, so the hover state becomes inaccessibleSidebarContainer as a direct child of EdgeSidebar — having multiple containers will cause the available space to split evenly, which mostly not the desired behavior.shrinkSize on SidebarIcon.Read the relevant page based on your needs:
Integration:
Layout patterns:
Sidebar features:
--_collapsed/--_uncollapsed CSS variables to style non-mui-treasury elements based on sidebar stateDemos:
tools
Use this skill when writing meta file for MUI Treasury registry.
development
Always use this skill when integrating Base UI components `@base-ui-components/react` with Material UI `@mui/material`.
documentation
Get better understanding about the structure before writing documentation for a software or system. Invoke when asked/requested to plan on creating documentation.
development
MUI component styling and implementation rules — sx prop patterns, theme usage, dark mode, spacing, accessibility, form best practices, chart config, and component-specific gotchas. Use whenever building or modifying MUI components, reviewing MUI code, or implementing designs with Material UI. Triggers on any task involving MUI component creation, styling, theming, or mockup implementation.