Center

Centers its children horizontally and vertically.

This will be centered

Usage

Code
import { Center } from '@leverui/components';

export function CenterUsage() {
  return <Center class="center-usage">This is the Center</Center>;
}
Code
/* center-usage.css */
.center-usage {
  height: 100px;
  background: tomato;
  color: #111827;
}

Examples

Icon

Center can be used to create frames around icons or numbers.

1

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

PropDefaultTypeDescription
inlinefalseResponsive booleanUse inline-flex, not flex. As wide as content.
asdivNative HTML tagHTML tag to render.
asChild—Solid render callbackRender your own element instead.
unstyledfalseBooleanTurn off the flex layout styles.

Square

PropDefaultTypeDescription
size—Size token, CSS length, or responsive valueWidth and height, same value.
asdivNative HTML tagHTML tag to render.
asChild—Solid render callbackRender your own element instead.
unstyledfalseBooleanTurn 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.