Skip to content

Container

Responsive container component that constrains content width at each breakpoint.

Also known as: wrapper, page container, content wrapper, max-width container

View in Storybook

When to use

  • Centering page content with responsive max-width. Use as the main layout wrapper.

Import

tsx
import { Container } from '@vacano/ui'

Usage

tsx
<Container>
  <h1>Page Title</h1>
  <p>Content is centered and has max-width.</p>
</Container>

Page Layout Example

tsx
function PageLayout() {
  return (
    <div>
      <header>
        <Container>
          <nav>Navigation</nav>
        </Container>
      </header>
      <main>
        <Container>
          <h1>Main Content</h1>
          <p>Your page content here.</p>
        </Container>
      </main>
      <footer>
        <Container>
          <p>Footer content</p>
        </Container>
      </footer>
    </div>
  )
}

Responsive Breakpoints

The container applies max-width at each breakpoint:

BreakpointMin WidthContainer Max Width
sm640px640px
md768px768px
lg1024px1024px
xl1280px1280px
2xl1536px1536px

Below 640px, the container is width: 100% with no max-width constraint.

Props

PropTypeDefaultDescription
childrenReactNode-Container content
classNamestring-CSS class name for the root element
refRef<HTMLDivElement>-Ref forwarded to the root div element
data-test-idstring-Test identifier attribute

All standard HTML div attributes are also supported.

CSS Class

The root element receives vacano_container_container.

  • Panel - Titled content section

Released under the MIT License.