MenuChevron Down
AbsoluteCenter - Docs - Artefact

AbsoluteCenter

Layout
Presentational

Introduction

A utility component for centering content within its parent container.

Usage

Centered Content
import { AbsoluteCenter } from "../components/ui";

export default function MyPage() {
  return (
    <div
      style={{
        position: "relative",
        height: "200px",
        width: "200px",
        border: "1px solid black",
      }}
    >
      <AbsoluteCenter axis="both">Centered Content</AbsoluteCenter>
    </div>
  );
}

CMS Page Builder

This component is available as an absoluteCenter block in the Page Builder (content/pages/*.json):

{
  "type": "absoluteCenter",
  "axis": "both",
  "children": [
    { "type": "badge", "text": "Centered Badge", "colorPalette": "purple", "variant": "solid" }
  ]
}

Props

PropTypeDescription
childrenanyContent to be rendered inside the component.
classstringCustom CSS classes.

| axis | `"horizontal" \ | "vertical" \ | "both"` | The axis to center the content on. |