Page Layout
A CSS Grid page frame whose `layout` attribute picks a left sidebar, a right aside, a centered column or full width.
<arc-page-layout>Overview
PageLayout picks its grid from the layout attribute. sidebar-left puts the sidebar slot in a 240px column left of the main content. sidebar-right puts the aside slot in a 300px column on the right. centered (the default) caps the content at a max width with auto margins, and wide lets it run full width.
Main content goes in the default slot. A slot that the current layout doesn't use is hidden, so switching layout doesn't mean moving content between slots.
At 768px and below, both sidebar layouts collapse to one stacked column. gap sets the space between regions and maxWidth sets the cap for centered.
Guidelines
Do
- Use sidebar-left for navigation, as in dashboards and admin panels
- Use sidebar-right for a detail panel, table of contents or filters
- Use centered for articles and documentation, with a `maxWidth` that keeps lines readable
- Put PageLayout inside AppShell to get a top bar and sidebar chrome around it
- Set `gap` to a value from your spacing scale
Don't
- Don't hand-code column widths in inline styles when a `layout` value already gives you them
- Don't put content in `aside` unless the layout is sidebar-right. It's hidden in every other layout
- Don't use `wide` for text without a max width inside it. Lines get too long to read on large screens
Features
- `maxWidth` defaults to 1120px and only applies to `centered`
- Both props are also set as `--max-width` and `--gap` custom properties
- The main column has `min-width: 0`, so wide content doesn't push it past its grid track
- Parts: `base`, `layout`, `sidebar`, `main`, `aside`
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<script type="module" src="@arclux/arc-ui"></script>
<arc-page-layout layout="sidebar-left">
<nav slot="sidebar" style="display: flex; flex-direction: column; gap: 8px;">
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</arc-page-layout>import { PageLayout } from '@arclux/arc-ui-react';
export function DashboardPage() {
return (
<PageLayout layout="sidebar-left">
<nav slot="sidebar" style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</PageLayout>
);
}<script setup>
import { PageLayout } from '@arclux/arc-ui-vue';
</script>
<template>
<PageLayout layout="sidebar-left">
<nav slot="sidebar" style="display: flex; flex-direction: column; gap: 8px;">
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</PageLayout>
</template><script>
import { PageLayout } from '@arclux/arc-ui-svelte';
</script>
<PageLayout layout="sidebar-left">
<nav slot="sidebar" style="display: flex; flex-direction: column; gap: 8px;">
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</PageLayout>import { Component } from '@angular/core';
import { PageLayout } from '@arclux/arc-ui-angular';
@Component({
imports: [PageLayout],
template: `
<arc-page-layout layout="sidebar-left">
<nav slot="sidebar" style="display: flex; flex-direction: column; gap: 8px;">
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</arc-page-layout>
`,
})
export class DashboardPageComponent {}import { PageLayout } from '@arclux/arc-ui-solid';
export function DashboardPage() {
return (
<PageLayout layout="sidebar-left">
<nav slot="sidebar" style={{ display: 'flex', 'flex-direction': 'column', gap: '8px' }}>
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</PageLayout>
);
}import { PageLayout } from '@arclux/arc-ui-preact';
export function DashboardPage() {
return (
<PageLayout layout="sidebar-left">
<nav slot="sidebar" style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
<a href="/dashboard">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Dashboard</h1>
<p>Main content area with full-width access.</p>
</main>
</PageLayout>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-page-layout — requires page-layout.css + base.css (or arc-ui.css) -->
<div class="arc-page-layout">
<div class="page-layout">
<div class="sidebar">
</div>
<div class="main">
PageLayout
</div>
<div class="aside">
</div>
</div>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-page-layout — self-contained, no external CSS needed -->
<style>
@media (max-width: 768px) {
.arc-page-layout([layout='sidebar-left']) .page-layout,
.arc-page-layout([layout='sidebar-right']) .page-layout { grid-template-columns: 1fr; }
}
</style>
<div class="arc-page-layout" style="display: block; box-sizing: border-box">
<div class="page-layout" style="padding: 40px 24px; gap: var(--gap); min-height: 100%; box-sizing: border-box">
<div style="display: none">
</div>
<div style="min-width: 0">
PageLayout
</div>
<div style="display: none">
</div>
</div>
</div>API
max-widthstring'1120px'- Maximum width of the content area when using the centered layout. Accepts any valid CSS length value. Has no effect on sidebar-left, sidebar-right, or wide layouts. Maps to the --max-width CSS custom property.
gapstring'var(--space-xl)'- Gap between the sidebar/aside and main content regions. Accepts any valid CSS length or spacing token. Maps to the --gap CSS custom property and applies to the CSS Grid gap in sidebar layouts.
layout'sidebar-left' | 'sidebar-right' | 'centered' | 'wide''centered'- Controls the column structure of the page. sidebar-left creates a 240px fixed column on the left for navigation. sidebar-right creates a 300px fixed column on the right for contextual content. centered constrains the main area to max-width with auto margins. wide allows content to stretch the full available width.
See also
- App ShellFull-page layout that puts a TopBar, a Sidebar and a scrolling content area into one frame, with a mobile sidebar toggle and an optional table-of-contents rail.
- ContainerCenters page content and caps its width, so sections share one line length and side margins.
- SectionA page section with vertical padding, a centered max width and an optional uppercase label.
- Page HeaderThe title block at the top of a page: an `<h1>`, an optional description, and slots for breadcrumbs, actions and tabs.