Layout
Container
Centres page content with a maximum width and responsive inline padding. Center centres anything in both axes.
import { Container, Center } from '@reactloom/ui';Examples
Container and Center
Centred inside a 640 px container
import { Center, Container, Text } from '@reactloom/ui';
export default function Example() {
return (
<Container size="sm" style={{ border: '1px dashed var(--pl-color-border-strong)', borderRadius: 8 }}>
<Center style={{ height: 120 }}>
<Text tone="muted">Centred inside a 640 px container</Text>
</Center>
</Container>
);
}API reference
Container props
| Prop | Type | Default |
|---|---|---|
size640 · 768 · 1024 · 1280 px | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'lg' |
paddingX | Responsive<Space> | '4' |
asOften main. | LayoutElement | 'div' |
Center props
| Prop | Type | Default |
|---|---|---|
inline | boolean | false |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
Container
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-size] | sm · md · lg · xl · full |
Center
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-inline] | present when on |
Accessibility
- Use as="main" for the page’s main content.
Usage guidelines
Do
- Use one Container per page region.
Don’t
- Don’t nest Containers.