Container
Centers its content horizontally and caps max-width at a readable measure. The canonical wrapper for page content — wrap your <main> in one and every page lays out the same way.
Plain <div> by default (polymorphic via as). Pair with as="main" so the wrapper is a navigable landmark for AT.
Preview
tsx
import { Container, Text } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Container size="md" padding="4" background="bg.subtle" borderRadius="md">
<Text>Constrained content</Text>
</Container>
);
}
size accepts sm (40rem), md (48rem), lg (default, 64rem), xl (80rem), 2xl (96rem), prose (65ch for reading copy), or full (no cap).
Preview
tsx
import { Container, Stack, Text } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Stack gap="3">
{(['sm', 'md', 'lg', 'prose'] as const).map((size) => (
<Container key={size} size={size} padding="3" background="bg.subtle" borderRadius="md">
<Text>
<code>size="{size}"</code> — content capped at this measure
</Text>
</Container>
))}
</Stack>
);
}
PropTypeDefaultDescription
className
string
—
Additional class names appended after Cynosure's base classes.
style
CSSProperties
—
Inline style overrides merged last.
children
ReactNode
—
Container content.
size
Responsive<ContainerSize>
"lg"
Max-width preset: `sm` (40rem), `md` (48rem), `lg` (64rem), `xl` (80rem),
`2xl` (96rem), `prose` (65ch), `full` (100%). Accepts a responsive object,
e.g. `size={{ base: 'sm', md: 'lg' }}`.
paddingX
—
Horizontal padding (left + right). Overrides `padding` on the X axis.
paddingY
—
Vertical padding (top + bottom). Overrides `padding` on the Y axis.
height
—
Element height. Accepts a `SpaceToken`, `LengthValue`, or named alias.
minWidth
—
Minimum width — useful for preventing flex children from collapsing.
background
—
Background colour. Use a `ColorToken` like `"bg.surface"` for theme awareness.
borderColor
—
Border colour. Pair with `borderWidth` to make the border visible.
opacity
Responsive<number | `${number}`>
—
Opacity 0–1. Use sparingly — prefer surface tokens over translucency.
overflowX
—
Horizontal-axis overflow control. Overrides `overflow` for the X axis.
display
—
CSS `display` value. `"contents"` removes the element's box from layout.
position
—
CSS `position`. Pair with `top`/`right`/`bottom`/`left` for placement.
top
—
Top inset (when positioned). Accepts a `SpaceToken`, `"auto"`, `"0"`, or `LengthValue`.
flex
Responsive<"1" | "none" | "auto" | "initial" | (string & {})>
—
Shorthand: `1 | auto | none | initial | <css>`. Resolves to `flex` on the child.
asChild
boolean
—
When `true`, renders the primitive's single React child via `Slot`,
forwarding className/style/ref/event handlers onto it.
as
ElementType
"div"
Rendered intrinsic element or component.
ref
ForwardedRef<Element>
—
Recipes
Section titled “Recipes”- App content:
<Container as="main" size="lg" />for tools and dashboards;<Container size="prose" />for long-form reading. - Pair with
Sectionfor vertically-padded sections:<Section><Container>...</Container></Section>. - Use a responsive
sizeto tighten the column on mobile and relax it on wide viewports:size={{ base: 'sm', md: 'lg' }}.