Center
Center centres its children both vertically and horizontally using flexbox.
**Important:** Children that use CSS Grid with fr units must define their own
width (e.g., w-96, max-w-md). This is because fr units require a defined
container width to calculate available space, but flex items without explicit
width use intrinsic sizing - creating a circular dependency where the grid
collapses to minimum content width.
Usage
Best practices
Centercentres a single child on both axes; grid children usingfrunits need an explicit width (e.g.w-96) or they collapse to min-content.as/renderare mutually exclusive (renderwins, dev-warned); useinlineto center inline-level content without breaking the text flow.Use
asto change the element (a tag); userenderonly to swap in a component (e.g. a router Link). Neverrender={<Box as=…/>}- passasdirectly.
Props
Also exports
- interface
CenterProps
Composition
Used by
Avatar, Breadcrumb, Button, Chart, CheckboxCardGroup, ColorPalette, CountrySelect, DataGridColumnFilter, DataGridTable, DocumentList, EditorialCard, FileUploadDropzone, FolderTile, IconCard, LoadingState, MenuItem, Pagination, ProductCard, Progress, RadioCardGroup, ResizablePanelGroup, Select, Sidebar, Swatch, SwatchFan, ThinkingTrace