Layout@knitui/components
Center
Center aligns its children on both the horizontal and vertical axes. It is a thin styled wrapper around Box that sets alignItems and justifyContent to center. The inline variant switches the display to inline-flex so it can sit inline with surrounding text.
import { Center } from "@knitui/components";Playground
Loading playground…
<Center
inline={false}
width="$xxl"
height="$xxl"
backgroundColor="$color3"
borderRadius="$md"
>
<Text>Center</Text>
</Center>Examples
Default
Default block centering — content is centered on both axes inside a fixed container.
Loading example…
Inline
Inline variant — the container shrinks to content width and sits inline with surrounding text.
Loading example…
Nested Children
Centering nested element children — any React node is centered correctly.
Loading example…
Multiple Containers
Multiple Center containers side by side — each cell centers its own content.
Loading example…
Full Width
Full-width centering pattern — stretch to the parent and center a card inside.
Loading example…
Props
| Prop | Type | Default | Description |
|---|---|---|---|
disabled system | boolean | undefined | — | |
shadow system | "xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined | — | |
theme system | ThemeName | null | undefined | — | Applies a theme to this element |
Accessibility & DOM props (2)
| Prop | Type |
|---|---|
key | Key | null | undefined |
ref | Ref<TamaguiElement> | undefined |
Plus 499 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.