Skip to content

Container

The container component is generally the outermost layout component set at the root or page level of your app. You can use it to set the width of the pages and how the page should be aligned.

See all the examples and details in the Storybook.

Usage

tsx
import { Container, Heading, Text } from "@samgl/graffiti-ui";

const MyContainer = () => {
  return (
    <Container $width="800px" $alignment="center" $flexDirection="column">
      <Heading $level={1}>Hello, world!</Heading>
      <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Text>
    </Container>
  );
};

Props

PropTypeDefaultOptionalDescription
$widthstringThe width of the Container.
$alignmentstringWhich side the content inside the container should be aligned to.
$flexDirectionstringThe direction of the content inside the container.
childrenReactNodeThe content of the Container.
classNamestringThe class name of the component, generally used when extending the component with a styled component.