Layout Components
[05] Layout Components
Container
Manages the main content area by centering it and applying a max-width. It ensures a consistent and readable layout across different screen sizes.
Container sets the width of a page's content column: it renders a <div> that fills its parent's width until it reaches the max-width set by its size. The full-width background behind it and the vertical spacing around it belong to a Section wrapped around the Container. For a bordered box around a single piece of content, use Card.
Basic usage
A centered, full-width wrapper that caps content at a readable max-width. md, wFull, flex, column, itemsCenter, gap, noPadding, outline, and sharp are defaults.
Container centers content and constrains width for optimal readability.
<Container border> <Title>Page Content</Title> <Text>Container centers content and constrains width for optimal readability.</Text></Container>Sizes
Sizes (xs, sm, md default, lg, xl) control the max-width: max-w-3xl through max-w-7xl. Resize the viewport to see narrower containers stop growing before wider ones do.
xs: max-w-3xl
sm: max-w-4xl
md (default): max-w-5xl
lg: max-w-6xl
xl: max-w-7xl
<Col> <Container xs border> <Text fontSemibold>xs: max-w-3xl</Text> </Container> <Container sm border> <Text fontSemibold>sm: max-w-4xl</Text> </Container> <Container border> <Text fontSemibold>md (default): max-w-5xl</Text> </Container> <Container lg border> <Text fontSemibold>lg: max-w-6xl</Text> </Container> <Container xl border> <Text fontSemibold>xl: max-w-7xl</Text> </Container></Col>Padding
Container defaults to noPadding: the parent Section usually owns vertical rhythm. Pass padding to opt in to size-driven internal padding.
noPadding (default)
Edges sit flush with the container box.
padding
Internal padding scales with the size prop.
<Col> <Container border> <Text fontSemibold>noPadding (default)</Text> <Text>Edges sit flush with the container box.</Text> </Container> <Container padding border> <Text fontSemibold>padding</Text> <Text>Internal padding scales with the size prop.</Text> </Container></Col>Appearances
Containers support color appearances: primary, secondary, success, danger, etc.
Primary Container
Highlighted content area
Success Container
Positive feedback area
<Col> <Container primary border> <Text fontSemibold>Primary Container</Text> <Text>Highlighted content area</Text> </Container> <Container success border> <Text fontSemibold>Success Container</Text> <Text>Positive feedback area</Text> </Container></Col>Variants
Use filled for solid backgrounds. outline is the default. Add shadow for elevation.
Solid background with primary color
Border only styling
Elevated with drop shadow
<Col> <Container filled primary padding> <Title filled primary>Filled Container</Title> <Text filled primary>Solid background with primary color</Text> </Container> <Container secondary border padding> <Title secondary>Outline Container (default)</Title> <Text secondary>Border only styling</Text> </Container> <Container shadow padding> <Title>Shadow Container</Title> <Text>Elevated with drop shadow</Text> </Container></Col>Shapes
Containers support different border radius styles. sharp is the default (no radius).
Sharp (default)
Rounded corners
Pill shape
<Col> <Container border> <Text fontSemibold>Sharp (default)</Text> </Container> <Container rounded border> <Text fontSemibold>Rounded corners</Text> </Container> <Container pill border padding> <Text fontSemibold>Pill shape</Text> </Container></Col>Responsive breakpoints
Container is a flex column by default. Use row to flow horizontally on desktop and mobileStack / tabletStack to stack on smaller screens.
Switches to stacked layout on tablets and below.
Resize your browser to see the responsive behavior.
<Container row tabletStack border padding> <Col> <Title>Left Content</Title> <Text>Switches to stacked layout on tablets and below.</Text> </Col> <Col> <Title>Right Content</Title> <Text>Resize your browser to see the responsive behavior.</Text> </Col></Container>Page layout pattern
The canonical page layout: a Section owns vertical padding and full-width background, the Container nested inside caps reading width and centers the content.
The Section handles the full-bleed background and outer padding. The Container constrains the inner content to a comfortable reading width.
<Section secondary> <Container> <PageTitle>Getting Started</PageTitle> <Text>The Section handles the full-bleed background and outer padding. The Container constrains the inner content to a comfortable reading width.</Text> </Container></Section>Frequently asked questions
Why are the children of my Container narrower than it is?
Container centers its children on the cross axis (itemsCenter is a default), so each child shrinks to its content width and sits in the middle. Add itemsStretch to the Container to make every child full width, or wFull to one child. Text alignment is separate: the lines inside a centered Text still start at the left unless it has textCenter.
Why does my content touch the screen edges on a phone?
Container has no padding by default: it only caps the width. The Section around it supplies the padding and scales it down on tablet and mobile, as in the page layout pattern. Without a Section, add padding to the Container, which also shrinks on smaller screens because responsiveSizing is on by default.
How do I set a max-width between two sizes?
Pass your own max-width class, such as className="max-w-[68rem]": it replaces the max-w-* class of the size, because a class you pass wins over the theme's. The prebuilt @vaneui/ui/css has no arbitrary utilities, so with it use style={{ maxWidth: '68rem' }} instead. The size prop still sets the gap between the children.
Container Props
| Prop | Category | Default | Description |
|---|---|---|---|
accent | Appearance | Accent color appearance (rose) | |
danger | Appearance | Danger color appearance (red) | |
info | Appearance | Info color appearance (cyan) | |
inheritAppearance | Appearance | Inherit appearance from parent — suppresses own data-appearance/data-variant, uses parent's CSS variables | |
primary | Appearance | Primary color appearance (gray) | |
secondary | Appearance | Secondary color appearance (gray) | |
success | Appearance | Success color appearance (green) | |
tertiary | Appearance | Tertiary color appearance | |
warning | Appearance | Warning color appearance (amber) | |
desktopStack | Breakpoint | Stack into a column at desktop width and below (max-desktop: 80rem) | |
mobileStack | Breakpoint | Stack into a column at mobile width and below (max-mobile: 48rem) | |
tabletStack | Breakpoint | Stack into a column at tablet width and below (max-tablet: 64rem) | |
flex1 | Flex | Take up remaining space (= | |
flexAuto | Flex | Grow but respect intrinsic size (= | |
flexNone | Flex | Don't grow and don't shrink (= | |
margin | Margin | Enable margin on all sides | |
marginB | Margin | Enable only bottom margin | |
marginT | Margin | Enable only top margin | |
marginX | Margin | Enable only horizontal (inline) margin | |
marginY | Margin | Enable only vertical (block) margin | |
noMargin | Margin | Disable margin (reset to 0) | |
noPadding | Padding | ✓ | Disable internal padding |
padding | Padding | Enable internal padding | |
paddingX | Padding | Enable only horizontal padding | |
paddingY | Padding | Enable only vertical padding | |
pill | Shape | Fully rounded corners (circular) | |
rounded | Shape | Medium rounded corners (default) | |
sharp | Shape | ✓ | No rounded corners (square) |
noShrink | Shrink | Prevent the flex item from shrinking below its content size (= | |
lg | Size | Large size | |
md | Size | ✓ | Medium size (default) |
sm | Size | Small size | |
xl | Size | Extra large size | |
xs | Size | Extra small size | |
skeleton | Skeleton | Show the component as a loading placeholder in its own size and shape. On a container, every component inside it becomes a placeholder too | |
strongBorder | Strong Border | Paint the border in the appearance's strong color instead of its soft one | |
textCenter | Text Align | Align text to center | |
textEnd | Text Align | Align text to the reading-direction end (right in LTR, left in RTL) | |
textJustify | Text Align | Justify text | |
textLeft | Text Align | Align text to left (physical side, does not flip under RTL) | |
textRight | Text Align | Align text to right (physical side, does not flip under RTL) | |
textStart | Text Align | Align text to the reading-direction start (left in LTR, right in RTL) | |
filled | Variant | Filled variant - solid background with contrasting text color | |
ghost | Variant | Ghost variant - transparent background, no border, appearance-colored text, tinted hover background | |
outline | Variant | ✓ | Outline variant - transparent background with border and colored text (default) |
Layout & utility props (gap, padding, hide, items, justify, ...)
Documented on Common Props.
| Prop | Category | Default | Description |
|---|---|---|---|
border | Border | Enable border on all sides | |
borderB | Border | Enable border on bottom | |
borderEnd | Border | Enable border on the inline-end side (right in LTR, left in RTL) | |
borderL | Border | Enable border on left | |
borderR | Border | Enable border on right | |
borderStart | Border | Enable border on the inline-start side (left in LTR, right in RTL) | |
borderT | Border | Enable border on top | |
borderX | Border | Enable border on left and right | |
borderY | Border | Enable border on top and bottom | |
noBorder | Border | Disable all borders | |
block | Display | Block display - takes full width, new line | |
contents | Display | Contents display - element's box is removed, children display as if parent didn't exist | |
flex | Display | ✓ | Flex display - flexbox container |
grid | Display | Grid display - CSS grid container | |
hidden | Display | Hidden display - element is not visible | |
inline | Display | Inline display - flows with text | |
inlineBlock | Display | Inline-block display - inline but with block properties | |
inlineFlex | Display | Inline-flex display - inline flexbox container | |
inlineGrid | Display | Inline-grid display - inline grid container | |
table | Display | Table display - behaves like table element | |
tableCell | Display | Table-cell display - behaves like td element | |
column | Flex Direction | ✓ | Flex direction column (vertical) |
columnReverse | Flex Direction | Flex direction column-reverse | |
row | Flex Direction | Flex direction row (horizontal) | |
rowReverse | Flex Direction | Flex direction row-reverse | |
gap | Gap | ✓ | Enable gap spacing between children, at the component's size |
gapLg | Gap | Large gap, whatever the component's size | |
gapMd | Gap | Medium gap, whatever the component's size | |
gapSm | Gap | Small gap, whatever the component's size | |
gapXl | Gap | Extra-large gap, whatever the component's size | |
gapXs | Gap | Extra-small gap, whatever the component's size | |
noGap | Gap | Disable gap spacing | |
hAuto | Height | Set height to auto | |
hFit | Height | Set height to fit-content | |
hFull | Height | Set height to 100% | |
hScreen | Height | Set height to 100vh (viewport height), removes max-height constraint | |
desktopHide | Hide | Hide element on desktop devices and below (max-desktop: 80rem) | |
mobileHide | Hide | Hide element on mobile devices and below (max-mobile: 48rem) | |
tabletHide | Hide | Hide element on tablet devices and below (max-tablet: 64rem) | |
itemsBaseline | Items | Align items to baseline | |
itemsCenter | Items | ✓ | Align items to center |
itemsEnd | Items | Align items to end (bottom/right) | |
itemsStart | Items | Align items to start (top/left) | |
itemsStretch | Items | Stretch items to fill container | |
justifyAround | Justify | Distribute items with space around them | |
justifyBaseline | Justify | Align items along their baseline on main axis | |
justifyBetween | Justify | Distribute items with space between them | |
justifyCenter | Justify | Center items along the main axis | |
justifyEnd | Justify | Pack items toward the end of the main axis | |
justifyEvenly | Justify | Distribute items with equal space around them | |
justifyStart | Justify | Pack items toward the start of the main axis | |
justifyStretch | Justify | Stretch items to fill the main axis | |
overflowAuto | Overflow | Auto overflow - show scrollbars if needed | |
overflowClip | Overflow | Clip overflow - hard clip without scrollbars | |
overflowHidden | Overflow | Hidden overflow - clip content without scrollbars | |
overflowScroll | Overflow | Scroll overflow - always show scrollbars | |
overflowVisible | Overflow | Visible overflow - content extends beyond bounds | |
overflowXAuto | Overflow | Auto overflow on X-axis only | |
overflowXClip | Overflow | Clip overflow on X-axis only | |
overflowXHidden | Overflow | Hidden overflow on X-axis only | |
overflowXScroll | Overflow | Scroll overflow on X-axis only | |
overflowXVisible | Overflow | Visible overflow on X-axis only | |
overflowYAuto | Overflow | Auto overflow on Y-axis only | |
overflowYClip | Overflow | Clip overflow on Y-axis only | |
overflowYHidden | Overflow | Hidden overflow on Y-axis only | |
overflowYScroll | Overflow | Scroll overflow on Y-axis only | |
overflowYVisible | Overflow | Visible overflow on Y-axis only | |
pointerEventsAuto | Pointer Events | Enable pointer events (default browser behavior) | |
pointerEventsNone | Pointer Events | Disable pointer events - clicks pass through the element | |
absolute | Position | Absolute positioning | |
fixed | Position | Fixed positioning | |
relative | Position | Relative positioning | |
static | Position | Static positioning | |
sticky | Position | Sticky positioning at the top edge; set --sticky-top to stick below a fixed header | |
responsiveSizing | Responsive Sizing | ✓ | Enable responsive sizing - uses breakpoint-specific classes for font size, padding, and gap |
desktopWFull | Responsive Width | Set width to 100% on desktop and below, below 1280px (max-desktop: 80rem) | |
mobileWFull | Responsive Width | Set width to 100% on mobile, below 768px (max-mobile: 48rem) | |
tabletWFull | Responsive Width | Set width to 100% on tablet and below, below 1024px (max-tablet: 64rem) | |
insetRing | Ring | Enable the inset ring — emits ring-inset | |
noInsetRing | Ring | ✓ | Disable the inset ring |
noShadow | Shadow | Disable drop shadow | |
shadow | Shadow | Enable drop shadow at the component's size | |
shadowLg | Shadow | Large drop shadow, whatever the component's size | |
shadowMd | Shadow | Medium drop shadow, whatever the component's size | |
shadowSm | Shadow | Small drop shadow, whatever the component's size | |
shadowXl | Shadow | Extra-large drop shadow, whatever the component's size | |
shadowXs | Shadow | Extra-small drop shadow, whatever the component's size | |
desktopShow | Show | Show element only on desktop and below, below 1280px (hidden from 80rem up) | |
mobileShow | Show | Show element only on mobile, below 768px (hidden from 48rem up) | |
tabletShow | Show | Show element only on tablet and below, below 1024px (hidden from 64rem up) | |
transparent | Transparent | Disable background color - makes component background transparent | |
whitespaceBreakSpaces | Whitespace | Preserve whitespace incl. trailing spaces, wrap text (white-space: break-spaces) | |
whitespaceNormal | Whitespace | Normal wrapping - default browser behavior | |
whitespaceNowrap | Whitespace | No wrap - text stays on single line | |
whitespacePre | Whitespace | Preserve whitespace and line breaks | |
whitespacePreLine | Whitespace | Preserve line breaks, collapse spaces, wrap text | |
whitespacePreWrap | Whitespace | Preserve whitespace, wrap text | |
wAuto | Width | Set width to auto | |
wFit | Width | Set width to fit-content | |
wFull | Width | ✓ | Set width to 100% |
wScreen | Width | Set width to 100vw (viewport width), removes max-width constraint | |
flexNoWrap | Wrap | Force flex items to stay on single line (may overflow) | |
flexWrap | Wrap | Allow flex items to wrap to new lines when container is too narrow | |
flexWrapReverse | Wrap | Wrap flex items in reverse order (last items wrap first) |