Center
Centers its children horizontally and vertically.
This will be centered
Usage
import { Center } from '@leverui/components';
export function CenterUsage() {
return <Center class="center-usage">This is the Center</Center>;
}
/* center-usage.css */
.center-usage {
height: 100px;
background: tomato;
color: #111827;
}
Examples
Icon
Center can be used to create frames around icons or numbers.
Center with Inline
Set inline to use display: inline-flex, so Center takes only the width its content needs. It can then sit naturally inside a link, button, or other inline context.
Square
Square centers its child within a fixed-size container of equal width and height. Its size prop sets both dimensions.
Circle
Circle applies border-radius: 9999px to an equal-size container. Like Square, its size prop sets both width and height.
Props
Center
| Prop | Default | Type | Description |
|---|---|---|---|
inline | false | Responsive boolean | Use inline-flex, not flex. As wide as content. |
as | div | Native HTML tag | HTML tag to render. |
asChild | — | Solid render callback | Render your own element instead. |
unstyled | false | Boolean | Turn off the flex layout styles. |
Square
| Prop | Default | Type | Description |
|---|---|---|---|
size | — | Size token, CSS length, or responsive value | Width and height, same value. |
as | div | Native HTML tag | HTML tag to render. |
asChild | — | Solid render callback | Render your own element instead. |
unstyled | false | Boolean | Turn off the shape layout styles. |
Circle
Same props as Square. Adds border-radius: 9999px.
All three accept class and style. Set sizes, spacing, and colors in your
own CSS or with --leverui-* variables.