Examples

Container and Center

Preview

Centred inside a 640 px container

Example.tsx
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

Container props
PropTypeDefault
size
640 · 768 · 1024 · 1280 px
'sm' | 'md' | 'lg' | 'xl' | 'full''lg'
paddingX
Responsive<Space>'4'
as
Often main.
LayoutElement'div'

Center props

Center props
PropTypeDefault
inline
booleanfalse

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.

AttributeValues
[data-size]sm · md · lg · xl · full

Center

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[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.