Description
The Container component provides a centered, responsive layout container with predefined maximum widths and horizontal padding. It’s designed to constrain content width while maintaining responsive padding and alignment across different screen sizes.Props
Container extends all standard HTML div attributes and accepts the following props:Controls the maximum width of the container
small- Max-width: 430px (100% on mobile < 480px)medium- Max-width: 715px (100% on mobile < 768px)large- Max-width: 1145px (100% on mobile < 1200px)none- No max-width constraint (default)
Controls horizontal alignment of the container
left- Aligns container to the left (margin-left: 0, margin-right: auto)center- Centers the container (margin-left: auto, margin-right: auto) (default)right- Aligns container to the right (margin-left: auto, margin-right: 0)
The content to be rendered inside the Container
Additional CSS class names to apply to the Container
ARIA role attribute for accessibility (defaults to “region”)
Accessibility label for the container region
ID of the element that labels this container
All standard HTML div attributes are supported including:
id- Element IDdata-*- Data attributes- Event handlers (
onClick,onMouseEnter, etc.)
Usage examples
Basic usage
Small container
Medium container
Large container
Left-aligned container
Right-aligned container
With accessibility attributes
With labelledby reference
With custom styling
Styling notes
The Container component includes responsive padding and width constraints:Base styles
box-sizing: border-box- Consistent box modelflex-shrink: 0- Prevents container from shrinkingwidth: 100%- Full width by default
Responsive padding
- Default (< 640px):
padding-leftandpadding-rightuse--rs-space-3 - ≥ 640px:
padding-leftandpadding-rightuse--rs-space-5
Size variants (max-width)
size="small": 430px (100% below 480px)size="medium": 715px (100% below 768px)size="large": 1145px (100% below 1200px)size="none": No max-width constraint
Alignment variants
align="left":margin-left: 0; margin-right: auto;align="center":margin-left: auto; margin-right: auto;align="right":margin-left: auto; margin-right: 0;