Center
Center is a layout component that centers its child within itself.
Import#
import { Center, Square, Circle } from "@chakra-ui/react"
- Center: centers its child given
widthandheight - Square: centers its child given
size(width and height) - Circle: a
Squarewith roundborder-radius
Usage#
Put any child element inside it, give it any width or/and height, it'll
ensure the child is centered.
This is the Center
Editable Example
With icons#
Center can be used to create frames around icons or numbers.
1
Editable Example
Square and Circle#
To reduce boilerplate, we've exported Square and Circle components that
automatically centers its children given the size.
Editable Example