···11+---
22+title: SidebarLayout
33+description: A flexible page layout component with unstyled slots for sidebar and page content.
44+---
55+66+import { PropDocs } from '../../../lib/PropDocs'
77+import { Example } from '../../../lib/Example'
88+import { Basic } from '../../../examples/sidebar-layout/basic'
99+import { WithHeaderLayout } from '../../../examples/sidebar-layout/with-header-layout'
1010+1111+<Example src={Basic} noPadding />
1212+1313+## Installation
1414+1515+Run the following command to add the sidebar layout component to your project.
1616+1717+```bash
1818+pnpm hip install sidebar-layout
1919+```
2020+2121+## Props
2222+2323+This is a custom component built for page layouts with sidebar and content slots.
2424+2525+<PropDocs components={["SidebarLayoutRoot", "SidebarLayoutSidebar", "SidebarLayoutPage"]} />
2626+2727+## Features
2828+2929+### With Header Layout
3030+3131+You can combine the sidebar layout with the header layout to create a page layout with a sidebar and header.
3232+3333+<Example src={WithHeaderLayout} noPadding />
3434+3535+## Related Components
3636+3737+- [Flex](/docs/components/flex) - For flexible layouts within slots
3838+- [Grid](/docs/components/grid) - For two-dimensional layouts within slots
3939+- [Sidebar](/docs/components/sidebar) - For navigation in the sidebar slot
4040+
+53
apps/docs/src/examples/sidebar-layout/basic.tsx
···11+import { SidebarLayout } from "@/components/sidebar-layout";
22+import {
33+ Sidebar,
44+ SidebarHeader,
55+ SidebarItem,
66+ SidebarSection,
77+} from "@/components/sidebar";
88+import { Link } from "@/components/link";
99+import { Text } from "@/components/typography/text";
1010+import { Body, Heading1 } from "@/components/typography";
1111+import { Content } from "@/components/content";
1212+1313+function Logo() {
1414+ return (
1515+ <svg
1616+ width="32"
1717+ height="32"
1818+ viewBox="0 0 120 120"
1919+ fill="black"
2020+ xmlns="http://www.w3.org/2000/svg"
2121+ >
2222+ <circle cx="60" cy="60" r="50" stroke="black" strokeWidth="2" />
2323+ </svg>
2424+ );
2525+}
2626+2727+export function Basic() {
2828+ return (
2929+ <SidebarLayout.Root>
3030+ <SidebarLayout.Sidebar>
3131+ <Sidebar>
3232+ <SidebarHeader href="/">
3333+ <Logo />
3434+ </SidebarHeader>
3535+ <SidebarSection title="Navigation">
3636+ <SidebarItem>Dashboard</SidebarItem>
3737+ <SidebarItem>Projects</SidebarItem>
3838+ <SidebarItem>Settings</SidebarItem>
3939+ </SidebarSection>
4040+ </Sidebar>
4141+ </SidebarLayout.Sidebar>
4242+ <SidebarLayout.Page>
4343+ <Content>
4444+ <Heading1>Page Content</Heading1>
4545+ <Body>
4646+ This is the main page content area. The sidebar is on the left, and
4747+ this content area takes up the remaining space.
4848+ </Body>
4949+ </Content>
5050+ </SidebarLayout.Page>
5151+ </SidebarLayout.Root>
5252+ );
5353+}