Main
The primary content area inside an <x-wirekit::. It renders a semantic <main> element that claims the remaining vertical space (flex-1) and scrolls independently from the header and sidebar (overflow-y-auto).
Content you place inside Main is laid out with a padding scale matched to the surrounding shell, and optionally constrained to a centered container width.
Basic Usage
By default, the component renders with padding lg (--space-wk-lg, 1.5rem). Drop any WireKit components inside.
Dashboard
Your content goes here.
Padding Scale
The padding prop accepts none, sm, md, lg, xl. Each value maps to a --space-wk-* design token so padding scales consistently with the rest of the shell.
Spacious layout
padding="xl" uses --space-wk-xl (2.5rem) on all sides.
Edge-to-edge section
Use padding="none" when the inner sections control their own spacing.
Container Layout
The children sit in a centered wrapper capped at the max width, 2xl (96rem = 1536px) unless you name another. The outer <main> still owns the full scroll area; the wrapper only affects where the inner content sits horizontally.
:container="true" asks for the same wrapper at 2xl. With the default max it changes nothing; it matters only beside max="none", where it brings the 2xl cap back. To choose a width, set max.
The centering becomes visible only where the <main> is wider than 96rem (1536px). In a narrower one, max-width doesn't constrain anything and the inner content fills the available area edge-to-edge — the mx-auto is there but has no excess space to center into. The preview below makes this explicit with two visible reference boxes: the dashed outer box is the <main> element, the solid inner box is the centering wrapper.
Centered content
Width-constrained to the 2xl container token (96rem). Open this page in a viewport wider than 1536px to see the solid inner box visibly centered inside the dashed outer area; at preview-box widths the two coincide because the max-width doesn't engage.
Default Padding Override
The default padding is read from config('wirekit.. Override it in config/ to change the default across an entire app:
// config/wirekit.php
return [
'components' => [
'main' => [
'padding' => 'md', // was 'lg'
],
],
];
Max-Width Cap
The max prop caps the content width to the matching --size-wk-container-* token tier. Default "2xl" (96rem / 1536px) keeps a dashboard from stretching edge-to-edge on a monitor 1900px wide and more, where lines of text grow too long to read comfortably.
<x-wirekit::main>{{-- max="2xl" by default --}}
{{ $slot }}
</x-wirekit::main>
<x-wirekit::main max="lg">{{-- tighter cap for documentation pages --}}
{{ $slot }}
</x-wirekit::main>
<x-wirekit::main max="none">{{-- no cap: the content fills the main --}}
{{ $slot }}
</x-wirekit::main>
Accepts sm, md, lg, xl, 2xl (default), full, none. The config key wirekit. overrides the default app-wide.
Because main already centers and width-caps its content, pass page content directly — don't wrap it in an extra <x-wirekit:: or a max-w-* div, which double-caps the width. Reach for max="none" when you want the content to fill the viewport, or when you lay the region out as a flex column: the cap holds the children in a wrapper of their own, so they are not the column's items, and a footer with mt-auto has nothing to push it down.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
padding |
string |
'lg' (from config) |
One of none, sm, md, lg, xl. Applied to all four sides. An unknown value is reported through strict validation. |
max |
string|null |
'2xl' (from config) |
Caps the content width to max-w-[--size-wk-container-{max}]. One of sm, md, lg, xl, 2xl, full, none. none disables the cap entirely. |
container |
bool |
false |
Center the children inside max-w-[--size-wk-container-2xl]. The default max does this already, so it matters only beside max="none"; see Container Layout. |
id |
string|null |
null |
When set, the element receives the given id and tabindex="-1" so JS-routing fragment navigation moves keyboard focus INTO the landmark. Pairs with <x-wirekit::skip-link> (which targets #main-content by default). |
scope |
string|null |
null |
Named personalization scope for block-level class overrides. |
Accessibility
- Rendered as a semantic
<main>element — announced by assistive tech as the main landmark - Pair with
<x-wirekit::for a WCAG 2.4.1 (Bypass Blocks) baseline: setskip-link> id="main-content"here and the skip-link's default target lands on this element with keyboard focus overflow-y-autopreserves keyboard scrolling (Space,PageDown, arrow keys) and never traps focus- When the area holds nothing focusable, Chromium lets
Tabstop on the scrolling<main>itself; it then shows the kit's focus ring along its inner edge, in the colors of the active preset - Content wider than the main scrolls the whole
<main>sideways, since a scroll container that scrolls on one axis scrolls on the other too. Keep wide content (tables, code blocks) responsive or in its own<x-wirekit::, so only that block scrollsscroll-area>
Keyboard Interaction
This component is a layout wrapper. Keyboard interaction is delegated to its children.
Design Tokens
| Token | Used for |
|---|---|
--space-wk-sm |
padding="sm" |
--space-wk-md |
padding="md" |
--space-wk-lg |
padding="lg" (default) |
--space-wk-xl |
padding="xl" |
--size-wk-container-2xl |
Inner max width when container is set |