AbsoluteCenter
Used to horizontally and vertically center an element relative to its parent dimensions using absolute positioning.
Usage
The AbsoluteCenter component uses the position: absolute strategy to center its child element
relative to its parent.
The parent element must have
position: relativefor proper positioning.
import { AbsoluteCenter } from "chakra-ui-solid";<Box position="relative" h="100px">
<AbsoluteCenter>Centered Content</AbsoluteCenter>
</Box>Examples
Axis Control
Control which axis to center on using the axis prop. Options are horizontal, vertical, or
both (default).
<AbsoluteCenter axis="horizontal" />
<AbsoluteCenter axis="vertical" />
<AbsoluteCenter axis="both" />
With Content
Use AbsoluteCenter with various content types like icons, badges, and status indicators.
Overlay Usage
Perfect for creating loading overlays or modal-like content that needs to be centered over existing content.
Loading...
RTL Support
AbsoluteCenter automatically handles right-to-left (RTL) layouts by adjusting the horizontal
positioning and transforms appropriately.
RTL (horizontal)
RTL (vertical)
RTL (both)
Props
AbsoluteCenterProps
Adds no prop of its own. It takes the three every component takes: as, render and unstyled.
axis is a recipe variant rather than a member of that interface, so it does not appear in the
table: it takes horizontal, vertical or both, and defaults to both.