Skip to content
Statix Design System

Patterns · Layout

Container

Centres page content and adds the side padding. Use it for every full-width band so content lines up from header to footer.

import { Container } from '@statix/ui/container';

Examples

Page width

The default page size caps content at 1280px with 20px side padding on phones and 32px from tablet on.

Your websites

yoga-berger.de, praxis-berger.de and berger-shop.de

<script lang="ts">
	import { Container } from '@statix/ui/container';
</script>

<div class="bg-secondary py-10">
	<Container>
		<div class="rounded-lg bg-card p-6">
			<p class="text-subtitle text-ink">Your websites</p>
			<p class="text-body text-ink-2">yoga-berger.de, praxis-berger.de and berger-shop.de</p>
		</div>
	</Container>
</div>

Sizes

narrow (880px) suits long text and forms. full drops the limit and the padding, for bleeding art or carousels.

page · 1280px
narrow · 880px
full · no limit, no padding
<script lang="ts">
	import { Container } from '@statix/ui/container';
</script>

<div class="flex flex-col gap-4 bg-secondary py-10">
	<Container>
		<div class="rounded-lg bg-card p-4 text-small text-ink-2">page · 1280px</div>
	</Container>
	<Container size="narrow">
		<div class="rounded-lg bg-card p-4 text-small text-ink-2">narrow · 880px</div>
	</Container>
	<Container size="full">
		<div class="bg-card p-4 text-small text-ink-2">full · no limit, no padding</div>
	</Container>
</div>

Guidelines

Do

  • Wrap each band of a page in one Container so the left edges line up.
  • Use narrow for legal pages, articles and single forms.

Don't

  • Don’t nest Containers. Inside one, use a grid or flex layout instead.
  • Don’t add your own horizontal padding to the page around it.

Accessibility

  • Renders a plain <div> with no role. Put landmarks (main, section) around or inside it.

API reference

Container

renders <div> and accepts its attributes
PropTypeDefault
size 'page' | 'narrow' | 'full'

page: 1280px max. narrow: 880px max. full: no limit and no padding.

'page'
ref bindHTMLDivElement | null

The rendered element.

–
class ClassValue

Merged with the size classes; yours win.

–
Data attributeMeaning
data-slot="container"Always present.
data-sizeThe current size.

containerVariants

The tailwind-variants function behind Container, for styling other elements the same way.