Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

AbsoluteCenter

Used to horizontally and vertically center an element relative to its parent dimensions using absolute positioning.

SourceStorybook
Centered Content

Usage

The AbsoluteCenter component uses the position: absolute strategy to center its child element relative to its parent.

The parent element must have position: relative for proper positioning.

import { AbsoluteCenter } from "@chakra-ui/react"
<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" />

horizontal

<AbsoluteCenter axis="vertical" />

vertical

<AbsoluteCenter axis="both" />

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.

Some content that is being loaded...

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

Previous

Center

Next

Container