Components

Center

A layout container that vertically and horizontally centers its children

Overview

Center is a flexbox-based centering container. display: flex, align-items: center, and justify-content: center are applied by default.

  • Polymorphic — Render as any HTML element via the as prop
  • Sprinkles support — All design token props available (p, m, bg, rounded, etc.)
  • Concise — Eliminates centering boilerplate

Basic Usage

import { Center } from '@illog/ui'
 
<Center width="100%" height="200px" bg="backgroundDefaultSecondary" rounded="200">
  <Text>Centered text</Text>
</Center>

Polymorphic Rendering

// Render as a section element
<Center as="section" p="600" bg="backgroundDefaultDefault">
  <Icon name="check" />
</Center>
 
// Render as a nav element
<Center as="nav" height="64px">
  <Logo />
</Center>

Props

PropTypeDefaultDescription
asElementType'div'HTML element to render
childrenReactNodeChild elements
classNamestringAdditional CSS class
...sprinklesSprinklesDesign token props (p, m, bg, color, rounded, width, height, gap, etc.)
...stylePropsStylePropsInline CSS props (top, left, transform, etc.)

display, alignItems, and justifyContent are fixed internally and cannot be overridden.

Guidelines

  • Use Center instead of Box when simple centering is needed
  • For single-axis alignment only, use Stack or Inline instead