Center
Centers content on one or both axes with responsive structural sizing.
Center places content on the horizontal axis, vertical axis, or both. It can also define the region’s size and responsive logical padding.
Import
Section titled “Import”import { Center } from "@zentara-co/zenos-ui";Choose only the axis the component should control. both is the default.
both
horizontal
vertical
Sizing and logical padding
Section titled “Sizing and logical padding”Size tokens constrain the centering region. Padding uses logical inline and block directions so layouts adapt to writing direction.
Horizontally centered inside a constrained region.
Inline center
Use isScrollable only when the centered region has a meaningful size constraint. When content may exceed the available height, test zoom and large text to ensure it remains reachable.
API
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | div | Rendered semantic element. |
axis | both | horizontal | vertical | both | Axes on which content is centered. |
isInline | boolean | false | Uses inline-flex instead of flex. |
padding* | Responsive<Spacing> | — | Logical responsive padding props. |
width / height / maxWidth / minHeight | SizeToken | — | Structural size constraints. |
isScrollable | boolean | false | Allows centered content to scroll when it exceeds the region. |
native props | React.HTMLAttributes<HTMLElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”Center does not change semantics. Choose as for the region’s meaning and avoid vertically centering long reading content in a fixed-height box, which can make overflow difficult to reach at high zoom.