Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Layout & primitives

Container

Free0.8 KB gzipped

Centers content with a max width and responsive side gutters. Never overflows its parent, so content reflows down to 320px wide.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · No keyboard interaction of its own · Full report

Import

tsx
import { Container } from "@vjdesigns/vjdesigns-ui";

Importing only Container adds about 0.8 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Sizes

Centers content at a max width. gutter="responsive" grows the side padding on wider screens.

size="xs"

size="sm"

size="md"

size="lg"

tsx
import { Box, Container, Stack, Text } from "@vjdesigns/vjdesigns-ui";

export function Sizes() {
  return (
    <Stack gap={2} style={{ width: "100%" }}>
      {(["xs", "sm", "md", "lg"] as const).map((size) => (
        <Container key={size} size={size} gutter={0}>
          <Box tone="primary" radius="md" p={3}>
            <Text size="sm" weight="semibold" tone="inherit">
              size="{size}"
            </Text>
          </Box>
        </Container>
      ))}
    </Stack>
  );
}

Prose

size="prose" caps the width at a comfortable line length for reading.

Long lines are tiring to read. Around 60 to 75 characters per line keeps the eye on track from the end of one line to the start of the next, which is what the prose size is tuned for.

tsx
import { Container, Text } from "@vjdesigns/vjdesigns-ui";

export function Prose() {
  return (
    <Container size="prose" gutter={0} style={{ width: "100%" }}>
      <Text leading="relaxed">
        Long lines are tiring to read. Around 60 to 75 characters per line keeps the eye on track from the end of
        one line to the start of the next, which is what the prose size is tuned for.
      </Text>
    </Container>
  );
}

Accessibility

A Container keeps content off the screen edges with gutter and caps line length with size, which keeps long text comfortable to read. Use as="main" (or another landmark) when it wraps a page's main region.

Release notes

Lines this long stay easy to follow because the container stops them from stretching across a wide screen.

tsx
import { Box, Container, Stack, Text, Heading } from "@vjdesigns/vjdesigns-ui";

export function Accessibility() {
  return (
    <Box border radius="lg" style={{ width: "100%" }}>
      <Container as="article" size="sm" gutter="responsive" py={6}>
        <Stack gap={2}>
          <Heading level={3} size="lg">
            Release notes
          </Heading>
          <Text tone="muted">
            Lines this long stay easy to follow because the container stops them from stretching across a wide screen.
          </Text>
        </Stack>
      </Container>
    </Box>
  );
}

Translated

Containers have no text of their own. LocaleProvider sets lang="ja" on the area, so screen readers and fonts use Japanese for the content.

コンテナは行の長さを抑えて、長い文章でも読みやすく保ちます。画面の端に文字が張り付かないよう、左右に余白も確保します。

tsx
import { Box, Container, Text, LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ja from "@vjdesigns/vjdesigns-ui/locales/ja";

export function Translated() {
  return (
    <LocaleProvider locale="ja" messages={ja}>
      <Box border radius="lg" style={{ width: "100%" }}>
        <Container size="sm" gutter="responsive" py={6}>
          <Text>
            コンテナは行の長さを抑えて、長い文章でも読みやすく保ちます。画面の端に文字が張り付かないよう、左右に余白も確保します。
          </Text>
        </Container>
      </Box>
    </LocaleProvider>
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Sizes

size="xs"

size="sm"

size="md"

size="lg"

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// Sizes is the "Sizes" example above.
<LocaleProvider locale="ar" messages={ar}>
  <Sizes />
</LocaleProvider>

API reference

Container

Container props
PropTypeDefault
as

Element to render. Use main, header, footer, section, or article for landmarks and structure.

"div""main""section""header""footer""article"—
size

Max width of the content: xs 480px, sm 640px, md 768px, lg 1024px, xl 1280px, 2xl 1536px, full 100%, prose 65ch.

"xs""sm""md""lg""xl""2xl""full""prose"—
gutter

Horizontal padding on both sides. "responsive" grows with the viewport.

ContainerGutter—
fluid

Removes the max width, keeping only the gutters. Overrides size.

boolean—
centerContent

Stacks children in a column and centers them horizontally.

boolean—
py

Vertical padding (top and bottom), as a spacing step.

Space—
childrenReactNode—

Also accepts standard HTML attributes, plus className, style and ref.

See what changed in each version in the Changelog.

Accessibility report

Container targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Dark mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Not focusable, so there's no keyboard interaction of its own.

Roles and states

Roles and states
ElementRoleStates and properties
<div>, or the element in asNative role of that element—

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)