Container
The one content edge: every page's width and side padding.
Overview
Content outside an AppShell, such as a band in a bleed shell, that must start at the same x as the page.
One edge
Do
Plan
import { Body, Card, Container } from "@hackcove/ui";
<Container as="section" aria-label="Billing">
<Card title="Plan">
<Body>Team, billed monthly.</Body>
</Card>
</Container>Container is the content edge: everything inside it starts at the same x.Don't
Plan
import { Body, Card, Container } from "@hackcove/ui";
<Container as="section" aria-label="Billing">
<Container>
<Card title="Plan">
<Body>Team, billed monthly.</Body>
</Card>
</Container>
</Container>Container inside a Container pads the content twice, so it no longer lines up with the page. AppShell already wraps its main in one.Usage
Containeris the only place the page width (max-w-6xl) and side padding are defined; a header, a page and a footer inside one start at the same x.AppShellalready wraps its header, main and footer in one. UseContaineronly for a part of ableedshell that spans the page, so its content still keeps the edge.- Never nest a
Containerin aContainer: the padding doubles. aspicks the element:div(default),main,header,footer,sectionornav. Asectionornavneeds anaria-label.- Space inside it with a
Stack; aContainerhas no vertical padding or gap of its own.
Accessibility
- A
Containeradds no role: adivis not a landmark.aspicksmain,header,footer,sectionornavwhen the part should be one. aria-*anddata-*go on the rendered element.
API
Container
The one content edge: every page's width and side padding. This file is the only place they are defined, so a header, a page and a footer inside a Container start at the same x.
as- Type
"nav" | "header" | "footer" | "main" | "div" | "section"
elementRefThe rendered element, for a parent that measures or scrolls it.
- Type
((element: HTMLElement | null) => void)