When to use
Section titled “When to use”Container limits the widest size of page content and centres it. It wraps the main area of a page or the content of a section.
When not to use
Section titled “When not to use”- For a box and padding: Use Box when no width limit is needed.
- To align items: Stack, Inline and Grid lay items out; Container only limits the width.
- Nested: Do not put a Container inside another Container; the inline padding applies twice.
Anatomy
Section titled “Anatomy”Container has one part: a <div> (or the element you give with render).
- Root: limited by
max-width, centred withmx-auto, with 16 px inline padding; 24 px from 1024 px.
Behaviour
Section titled “Behaviour”- The width is chosen with
size:sm,md(default),lgorfull. - When the parent is narrower than the limit, Container takes the parent width (
w-full). - Inline padding changes from 16 px to 24 px at a 1024 px viewport width (the
lgbreakpoint). - It does not move and does not take focus.
Guidelines
Section titled “Guidelines”Choose the width for the content
Section titled “Choose the width for the content”Sample text
Sample text
Do not change the width with className
Section titled “Do not change the width with className”className is for block margins and padding only. When you need another width, change size.
Content
Section titled “Content”Container shows no text of its own; its children decide the content. Use render for <main> and keep one per page.