Patterns · Layout
Section
A page band with vertical rhythm and a Container inside. Landing pages stack Sections, each with its own heading.
import { Section } from '@statix/ui/section';Examples
With a heading
The default lg spacing gives 80px top and bottom on phones and 128px from tablet on.
Backups you never have to think about
We save your website every night and keep 30 versions. A restore takes one click.
<script lang="ts">
import { Section } from '@statix/ui/section';
import { SectionHeading } from '@statix/ui/section-heading';
</script>
<Section aria-labelledby="backups-title">
<SectionHeading
id="backups-title"
title="Backups you never have to think about"
description="We save your website every night and keep 30 versions. A restore takes one click."
spacing="none"
/>
</Section>Spacing and fill
md and sm tighten the rhythm for dense pages. Alternate bg-secondary bands to separate Sections without lines.
spacing="md" on bg-secondary
spacing="sm"
spacing="sm", container="narrow"
<script lang="ts">
import { Section } from '@statix/ui/section';
</script>
<Section spacing="md" class="bg-secondary">
<p class="text-subtitle text-ink">spacing="md" on bg-secondary</p>
</Section>
<Section spacing="sm">
<p class="text-subtitle text-ink">spacing="sm"</p>
</Section>
<Section spacing="sm" container="narrow" class="bg-secondary">
<p class="text-subtitle text-ink">spacing="sm", container="narrow"</p>
</Section>Guidelines
Do
- Give each Section one SectionHeading and an aria-labelledby pointing at it.
- Use the same spacing for neighbouring Sections. Change it only to group related bands.
Don't
- Don’t stack borders between Sections. Use a fill change instead.
Accessibility
- Renders a <section>. It becomes a region landmark only when it has an accessible name, so pass aria-labelledby or aria-label for the main bands.
API reference
Section
renders<section> and accepts its attributes| Prop | Type | Default |
|---|---|---|
spacing | 'lg' | 'md' | 'sm' | 'none' Vertical padding. lg 80/128px, md 64/96px, sm 40/56px (phone/tablet and up). | 'lg' |
container | 'page' | 'narrow' | 'full' Size of the inner Container. | 'page' |
innerClass | ClassValue Classes for the inner Container. | – |
ref bind | HTMLElement | null The <section> element. | – |
class | ClassValue Merged with the spacing classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="section" | Always present. |
sectionVariants
The tailwind-variants function behind Section.