Component reference
Center
An empty-state composition centered within a surface.
Preview
Live previewOptional six-digit hex. Clear to restore the preset. Check contrast with your brand color.
Changes apply to this preview only.
No projects yet
Create the first project to start collecting feedback.
Sign-in panel
Centering also works with a full-height section in a page layout.
Stats row
Inline centers keep icon and label on the same baseline.
Width adapts to the available space
"use client";
import {
Card,
CardContent,
Center,
Stack,
Badge,
Heading,
Paragraph,
Button,
CardHeader,
CardTitle,
CardDescription,
Box,
Text,
HStack
} from "@pimolu/react";
export function DemoExample() {
return (
<div
className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,280px),1fr))] gap-6 min-w-0 items-start"
>
<Card>
<CardContent>
<Center minHeight={220}>
<Stack gap={3} align="center">
<Center inline minHeight={64}>
<Badge variant="primary">+</Badge>
</Center>
<Stack gap={1} align="center">
<Heading level={3} size="lg">No projects yet</Heading>
<Paragraph size="sm" tone="muted" style={{ textAlign: "center" }}>
Create the first project to start collecting feedback.
</Paragraph>
</Stack>
<Button size="sm">Create a project</Button>
</Stack>
</Center>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Sign-in panel</CardTitle>
<CardDescription>
Centering also works with a full-height section in a page
layout.
</CardDescription>
</CardHeader>
<CardContent>
<Center
minHeight={260}
style={{
background: "var(--pimolu-muted)",
borderRadius: "var(--pimolu-radius-md)",
}}
>
<Box
padding={6}
background="surface"
style={{
width: "100%",
maxWidth: 280
}}
>
<Stack gap={3}>
<Text weight="medium">Welcome back</Text>
<Text size="sm" tone="muted">
The panel is centered inside a muted stage; the action stays
full width.
</Text>
<Button size="sm" fullWidth>Continue</Button>
</Stack>
</Box>
</Center>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Stats row</CardTitle>
<CardDescription>
Inline centers keep icon and label on the same baseline.
</CardDescription>
</CardHeader>
<CardContent>
<HStack gap={4} wrap>
{
[
["12", "projects"],
["4.2k", "followers"],
["128", "reviews"],
].map(([value, label]) => (<HStack key={label} gap={2} align="center">
<Center
inline
minHeight={36}
style={{
minWidth: 36,
borderRadius: "var(--pimolu-radius-full)",
background: "var(--pimolu-muted)",
}}
>
<Text size="xs" weight="semibold">
{value}
</Text>
</Center>
<Text size="sm" tone="muted">
{label}
</Text>
</HStack>))
}
</HStack>
</CardContent>
</Card>
</div>
);
}More examples
Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.
Both axes
The box stretches to the available width; minHeight gives the centering something to work with.
Inline
inline renders an inline-flex box that shrinks to its content and can sit in a line of text.
Minimum height
Numbers are pixels; CSS lengths such as 40vh pass through.
Usage
Provide enough height for the task and let content expand instead of forcing fixed dimensions.
API reference
Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.
PimoluCenterProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
as | ElementType | undefined | `div` | Element rendered by the center box. Defaults to `div`. |
inline | boolean | undefined | false | Centers as `inline-flex` instead of `flex`, so the box shrinks to its content and can sit in a line of text. |
minHeight | PimoluCenterMinHeight | undefined | — | Minimum block size. Numbers are pixels. |
fullWidth | boolean | undefined | false | Fill the available inline size. |
defaultValue | string | number | readonly string[] | undefined | — | Standard React/HTML attribute. |
className | string | undefined | — | Standard React/HTML attribute. |
style | CSSProperties | undefined | — | Standard React/HTML attribute. |
aria-label | string | undefined | — | Defines a string value that labels the current element. |
children | ReactNode | — | Standard React/HTML attribute. |
onChange | ChangeEventHandler<HTMLElement, Element> | undefined | — | Standard React/HTML attribute. |
onClick | MouseEventHandler<HTMLElement> | undefined | — | Standard React/HTML attribute. |
asElementType | undefinedDefault: `div`
Element rendered by the center box. Defaults to `div`.
inlineboolean | undefinedDefault: false
Centers as `inline-flex` instead of `flex`, so the box shrinks to its content and can sit in a line of text.
minHeightPimoluCenterMinHeight | undefinedNo default extracted.
Minimum block size. Numbers are pixels.
fullWidthboolean | undefinedDefault: false
Fill the available inline size.
defaultValuestring | number | readonly string[] | undefinedNo default extracted.
Standard React/HTML attribute.
classNamestring | undefinedNo default extracted.
Standard React/HTML attribute.
styleCSSProperties | undefinedNo default extracted.
Standard React/HTML attribute.
aria-labelstring | undefinedNo default extracted.
Defines a string value that labels the current element.
childrenReactNodeNo default extracted.
Standard React/HTML attribute.
onChangeChangeEventHandler<HTMLElement, Element> | undefinedNo default extracted.
Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefinedNo default extracted.
Standard React/HTML attribute.
Accessibility
- Keep the semantic reading order intact and avoid clipping at text zoom.