Components/Layout/Center

Center

Layout

Centres a single child element both horizontally and vertically.

Applies display: flex; align-items: center; justify-content: center. Use inline for an inline-flex version that doesn't expand to fill its container.

Usage

import { Center, Loader } from "nosible-ux"

export default function Example() {
  return (
    <Center style={{ height: 200 }}>
      <Loader />
    </Center>
  )
}

Examples

Inline centering

Global scan active

Props

Name TypeDefaultDescription
asChild
boolean | undefinedWhen true, merges Center styles onto the child element instead of a wrapper div.
inline
boolean | undefinedWhen true, renders as inline-flex instead of flex. Useful for inline centering (e.g. icon + text pairing). Default: false.