Playground

Container

Centre content in a column with a sensible maximum width and side padding.

  • Built on native elements
  • A plain div; adds no roles.
  • Styles in one file: container.css

Import

import '@monoline/css';
import {Container} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add container

Usage

import {Container} from '@monoline/react';

<Container size="text">
  <p>A column about 64 characters wide, centred, with side padding.</p>
</Container>

Examples

Reading column

Props

ContainerProps

PropTypeDefaultDescription
size"page" | "text" | "full"'page'`text` is a reading column, `page` the widest main column, `full` no limit.
asChildboolean–Render the child (a `main`, `section`) with the container styles.

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

This component sets no state attributes.

CSS classes

ClassStylesheet
.containercontainer.css
.container-fullcontainer.css
.container-pagecontainer.css
.container-textcontainer.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.container {
  border-color: var(--accent);
}

Accessibility

  • A plain div; adds no roles.