Skip to main content
Version: 1.0.2

Container

Overview

The Container component is a flexible layout component that constrains content width, adds consistent padding, and handles responsive behavior. It's perfect for creating readable content areas with proper spacing.

Preview

Try out the Container component with different settings:

Preview

Container Preview

The container size is set to normal. This affects the maximum width of the content area.

Column 1

This content is inside the container.

Column 2

It will be constrained by the container's size.

Column 3

Resize the browser to see responsive behavior.

Current props: padding: normal, center: Yes, responsive: Yes

Installation

npx @mindfiredigital/ignix-ui add container

Usage

Import the component:

import { Container } from './components/ui';

Basic Usage

import { Container } from './components/ui';

function MyComponent() {
return (
<Container>
Your content here
</Container>
);
}

Props

PropTypeDefaultDescription
size'small' | 'normal' | 'large' | 'full' | 'readable''normal'Controls the maximum width of the container
centerbooleantrueWhether to center the container horizontally
padding'none' | 'small' | 'normal' | 'large' | 'xl''normal'Controls the padding around the content
maxWidth'sm' | 'md' | 'lg' | 'xl' | 'full' | string'lg'Custom max-width for the container (overrides size)
responsivebooleantrueAdds responsive padding on the sides
classNamestring''Additional CSS classes
childrenReactNode-Content to be rendered inside the container

Examples

Different Sizes

<Container size="small">Small container</Container>
<Container size="normal">Normal container (default)</Container>
<Container size="large">Large container</Container>
<Container size="readable">Readable text width</Container>
<Container size="full">Full width container</Container>

Custom Padding

<Container padding="none">No padding</Container>
<Container padding="small">Small padding</Container>
<Container padding="normal">Normal padding (default)</Container>
<Container padding="large">Large padding</Container>
<Container padding="xl">Extra large padding</Container>

Disable Centering

<Container center={false}>Not centered</Container>

Custom Max Width

<Container maxWidth="md">Medium max width</Container>
<Container maxWidth="800px">Custom pixel width</Container>

Best Practices

  • Use the readable size for long-form text content to maintain optimal line length
  • Consider disabling responsive padding (responsive={false}) for full-bleed components
  • Use the full size with caution, as it removes the max-width constraint
  • Combine with other layout components for complex page structures