Layout

SidebarLeftContainer

A pre-built layout wrapper with a sidebar on the left (1/3 width) and main content on the right (2/3 width). Perfect for navigation, filters, or supplementary content.

Basic Examples

1. Basic Sidebar Layout

Sidebar

1/3 width sidebar content

Main Content

2/3 width main content area

basic-sidebar-layout
---
import SidebarLeftContainer from '@alfadormx/blocks/layout/SidebarLeftContainer.astro';
---

<SidebarLeftContainer
  htmlTag="section"
  containerWidthType="full"
  content={{
    widthType: 'boxed',
    spacing: { padding: 'py-8' },
    border: { width: 'border', color: 'border-border-emphasis border-dotted' },
  }}
  border={{ width: 'border', color: 'border-border' }}
  spacing={{ margin: 'mb-8' }}
>
  <div slot="sidebar" class="bg-primary text-background p-6 rounded">
    <p class="font-semibold">Sidebar</p>
    <p>1/3 width sidebar content</p>
  </div>
  <div slot="main" class="bg-success text-background p-6 rounded">
    <p class="font-semibold">Main Content</p>
    <p>2/3 width main content area</p>
  </div>
</SidebarLeftContainer>

2. Navigation Sidebar

Dashboard Overview

Welcome to your dashboard. Here you can manage your projects, view team activity, and configure settings.

24
Active Projects
156
Completed Tasks
navigation-sidebar
---
import SidebarLeftContainer from '@alfadormx/blocks/layout/SidebarLeftContainer.astro';
import Headline from '@alfadormx/blocks/primitives/Headline.astro';
---

<SidebarLeftContainer
  htmlTag="section"
  containerWidthType="full"
  content={{
    widthType: 'boxed',
    spacing: { padding: 'py-12' },
    border: { width: 'border', color: 'border-border-emphasis border-dotted' },
  }}
  border={{ width: 'border', color: 'border-border' }}
  spacing={{ margin: 'mb-8' }}
>
  <div slot="sidebar" class="bg-primary text-background p-6 rounded">
    <p class="font-semibold">Navigation</p>
    <nav>
      <a href="#" class="block py-2 px-3 bg-background text-primary rounded">
        Dashboard
      </a>
      <a href="#" class="block py-2 px-3 text-background hover:bg-primary-hover rounded">
        Projects
      </a>
      <a href="#" class="block py-2 px-3 text-background hover:bg-primary-hover rounded">
        Team
      </a>
      <a href="#" class="block py-2 px-3 text-background hover:bg-primary-hover rounded">
        Settings
      </a>
    </nav>
  </div>
  <div slot="main" class="bg-surface p-6 rounded border border-border">
    <Headline title="Dashboard Overview" htmlTag="h4" class="my-0" titleClass="mb-4 text-2xl" />
    <p>
      Welcome to your dashboard. Here you can manage your projects, view team activity, and
      configure settings.
    </p>
    <div class="grid grid-cols-2 gap-4 mt-6">
      <div class="bg-primary text-background p-4 rounded">
        <div class="text-2xl font-bold">24</div>
        <div class="text-sm">Active Projects</div>
      </div>
      <div class="bg-success text-background p-4 rounded">
        <div class="text-2xl font-bold">156</div>
        <div class="text-sm">Completed Tasks</div>
      </div>
    </div>
  </div>
</SidebarLeftContainer>

3. Filter Sidebar

Filters

Category

Price Range

Product 1

High-quality wireless headphones with noise cancellation.

Product 2

Premium laptop stand with adjustable height.

Product 3

Ergonomic mechanical keyboard for productivity.

filter-sidebar
---
import SidebarLeftContainer from '@alfadormx/blocks/layout/SidebarLeftContainer.astro';
import Headline from '@alfadormx/blocks/primitives/Headline.astro';
---

<SidebarLeftContainer
  htmlTag="section"
  containerWidthType="full"
  content={{
    widthType: 'boxed',
    spacing: { padding: 'py-12' },
    border: { width: 'border', color: 'border-border-emphasis border-dotted' },
  }}
  border={{ width: 'border', color: 'border-border' }}
  spacing={{ margin: 'mb-8' }}
>
  <div slot="sidebar" class="bg-surface p-6 rounded border border-border">
    <Headline title="Filters" htmlTag="h4" class="my-0" titleClass="mb-3 text-lg" />
    <div class="space-y-4">
      <div>
        <p class="font-semibold mb-2">Category</p>
        <label class="flex items-center gap-2">
          <input type="checkbox" />
          <span>Electronics</span>
        </label>
        <label class="flex items-center gap-2">
          <input type="checkbox" />
          <span>Clothing</span>
        </label>
        <label class="flex items-center gap-2">
          <input type="checkbox" />
          <span>Books</span>
        </label>
      </div>
      <div>
        <p class="font-semibold mb-2">Price Range</p>
        <label class="flex items-center gap-2">
          <input type="radio" name="price" />
          <span>Under $50</span>
        </label>
        <label class="flex items-center gap-2">
          <input type="radio" name="price" />
          <span>$50 - $100</span>
        </label>
        <label class="flex items-center gap-2">
          <input type="radio" name="price" />
          <span>Over $100</span>
        </label>
      </div>
    </div>
  </div>
  <div slot="main" class="space-y-4">
    <div class="bg-surface p-6 rounded border border-border">
      <p class="font-semibold">Product 1</p>
      <p class="text-muted mb-2">High-quality wireless headphones with noise cancellation.</p>
      <div class="text-xl font-bold text-link">$89.99</div>
    </div>
    <div class="bg-surface p-6 rounded border border-border">
      <p class="font-semibold">Product 2</p>
      <p class="text-muted mb-2">Premium laptop stand with adjustable height.</p>
      <div class="text-xl font-bold text-link">$49.99</div>
    </div>
    <div class="bg-surface p-6 rounded border border-border">
      <p class="font-semibold">Product 3</p>
      <p class="text-muted mb-2">Ergonomic mechanical keyboard for productivity.</p>
      <div class="text-xl font-bold text-link">$129.99</div>
    </div>
  </div>
</SidebarLeftContainer>

4. With Background Gradient

Welcome to Our Platform

Discover powerful features designed to streamline your workflow and boost productivity.

Our intuitive interface makes it easy to get started, while advanced features give you the flexibility you need as you grow.

with-background-gradient
---
import SidebarLeftContainer from '@alfadormx/blocks/layout/SidebarLeftContainer.astro';
import Button from '@alfadormx/blocks/primitives/Button.astro';
import Headline from '@alfadormx/blocks/primitives/Headline.astro';
---

<SidebarLeftContainer
  htmlTag="section"
  containerWidthType="full"
  background={{ class: 'bg-linear-to-r from-tertiary to-accent' }}
  content={{
    widthType: 'boxed',
    spacing: { padding: 'py-12' },
    border: { width: 'border', color: 'border-border-emphasis border-dotted' },
  }}
  border={{ width: 'border', color: 'border-border' }}
  spacing={{ margin: 'mb-8' }}
>
  <div slot="sidebar" class="bg-surface/90 backdrop-blur p-6 rounded shadow-lg">
    <p class="font-semibold">Quick Links</p>
    <ul>
      <li>
        <a href="#" class="text-link hover:underline">
          Getting Started
        </a>
      </li>
      <li>
        <a href="#" class="text-link hover:underline">
          Documentation
        </a>
      </li>
      <li>
        <a href="#" class="text-link hover:underline">
          API Reference
        </a>
      </li>
      <li>
        <a href="#" class="text-link hover:underline">
          Support
        </a>
      </li>
    </ul>
  </div>
  <div slot="main" class="bg-surface/90 backdrop-blur p-6 rounded shadow-lg">
    <Headline
      title="Welcome to Our Platform"
      htmlTag="h4"
      class="my-0"
      titleClass="mb-4 text-2xl"
    />
    <p class="mb-4">
      Discover powerful features designed to streamline your workflow and boost productivity.
    </p>
    <p class="mb-4">
      Our intuitive interface makes it easy to get started, while advanced features give you the
      flexibility you need as you grow.
    </p>
    <Button label="Get Started" intent="tertiary" />
  </div>
</SidebarLeftContainer>

5. Responsive (Stacks on Mobile)

Sidebar

This sidebar stacks on top on mobile devices.

Main Content

Main content appears below sidebar on mobile.

responsive-stacks-on-mobile
---
import SidebarLeftContainer from '@alfadormx/blocks/layout/SidebarLeftContainer.astro';
---

<SidebarLeftContainer
  htmlTag="section"
  containerWidthType="full"
  content={{
    widthType: 'boxed',
    spacing: { padding: 'py-8' },
    border: { width: 'border', color: 'border-border-emphasis border-dotted' },
  }}
  border={{ width: 'border', color: 'border-border' }}
  responsive={true}
  spacing={{ margin: 'mb-8' }}
>
  <div slot="sidebar" class="bg-accent text-background p-6 rounded">
    <p class="font-semibold">Sidebar</p>
    <p class="text-sm">This sidebar stacks on top on mobile devices.</p>
  </div>
  <div slot="main" class="bg-error text-background p-6 rounded">
    <p class="font-semibold">Main Content</p>
    <p class="text-sm">Main content appears below sidebar on mobile.</p>
  </div>
</SidebarLeftContainer>

Practical Use Cases

6. Blog Layout

About the Author

John Doe is a software engineer with 10 years of experience.

Building Modern Web Applications

Published on December 24, 2025 • 5 min read

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis.

blog-layout
---
import SidebarLeftContainer from '@alfadormx/blocks/layout/SidebarLeftContainer.astro';
import Headline from '@alfadormx/blocks/primitives/Headline.astro';
---

<SidebarLeftContainer
  htmlTag="section"
  containerWidthType="full"
  content={{
    widthType: 'boxed',
    spacing: { padding: 'py-12' },
    border: { width: 'border', color: 'border-border-emphasis border-dotted' },
  }}
  border={{ width: 'border', color: 'border-border' }}
  gap="loose"
  spacing={{ margin: 'mb-8' }}
>
  <div slot="sidebar" class="space-y-6">
    <div class="bg-surface p-6 rounded border border-border">
      <Headline title="About the Author" htmlTag="h4" class="my-0" titleClass="mb-3 text-lg" />
      <div class="w-20 h-20 bg-primary rounded-full mx-auto mb-3"></div>
      <p class="text-sm text-muted text-center">
        John Doe is a software engineer with 10 years of experience.
      </p>
    </div>
    <div class="bg-surface p-6 rounded border border-border">
      <Headline title="Categories" htmlTag="h4" class="my-0" titleClass="mb-3 text-lg" />
      <ul>
        <li>
          <a href="#" class="text-link hover:underline">
            Technology (24)
          </a>
        </li>
        <li>
          <a href="#" class="text-link hover:underline">
            Design (18)
          </a>
        </li>
        <li>
          <a href="#" class="text-link hover:underline">
            Business (12)
          </a>
        </li>
      </ul>
    </div>
    <div class="bg-surface p-6 rounded border border-border">
      <Headline title="Recent Posts" htmlTag="h4" class="my-0" titleClass="mb-3 text-lg" />
      <ul>
        <li>
          <a href="#" class="text-sm text-link hover:underline">
            Getting Started with Astro
          </a>
        </li>
        <li>
          <a href="#" class="text-sm text-link hover:underline">
            Tailwind CSS Tips
          </a>
        </li>
        <li>
          <a href="#" class="text-sm text-link hover:underline">
            Modern Web Development
          </a>
        </li>
      </ul>
    </div>
  </div>
  <div slot="main" class="bg-surface p-8 rounded border border-border">
    <Headline
      title="Building Modern Web Applications"
      htmlTag="h4"
      class="my-0"
      titleClass="mb-4 text-3xl"
    />
    <div class="text-sm text-muted mb-6">Published on December 24, 2025 • 5 min read</div>
    <p class="mb-4">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut
      labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
      laboris.
    </p>
    <p class="mb-4">
      Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
      pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
      mollit anim id est laborum.
    </p>
    <p class="mb-4">
      Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
      laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis.
    </p>
  </div>
</SidebarLeftContainer>

API Reference

PropTypeDefaultDescription
gapGridGap'normal'Gap between columns, responsive (default: 'normal')
responsivebooleanfalseResponsive behavior (default: false - always side-by-side)
breakpointstring'md:'Responsive breakpoint (default: 'md:' - use 'sm:', 'lg:', etc.)
sidebarCellProps—Configuration for the sidebar column
mainContentCellProps—Configuration for the main content column