If true, container will center its children
regardless of their width.
Container
Containers are used to constrain a content's width to the current breakpoint, while keeping it fluid.
By default, it sets the max-width of the content to 60 characters (60ch) but
you can customize this by passing custom maxWidth values or changing the
container size tokens defined in theme.sizes.container.
Import#
import { Container } from "@chakra-ui/react"
Usage#
To contain any piece of content, wrap it in the Container component.
Container Size#
To set the size of a Container, use the maxW attribute.
Centering the children#
In some cases, the width of the content can be smaller than the container's
width, you can use the centerContent prop to center the content.
<Container maxW="xl" centerContent><Box padding="4" bg="gray.100" maxW="3xl">There are many benefits to a joint design and development system. Not onlydoes it bring benefits to the design team.</Box></Container>
Props#
Container composes Box so you can pass all Box related props in addition to
this.
centerContent
centerContentbooleancolorScheme
colorSchemeColor Schemes for Container are not implemented in the default theme. You can extend the theme to implement them.
"whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"size
sizeSizes for Container are not implemented in the default theme. You can extend the theme to implement them.
stringvariant
variantVariants for Container are not implemented in the default theme. You can extend the theme to implement them.
string