Nhảy tới nội dung
Phiên bản: 1.11.0

Center là component để căn giữa phần tử theo chiều ngang.

box_padding_margin

Properties

NameTypeDefaultDescription
andTextbooleanfalse

Center align the text too

childrenReact.ReactNode

ReactNode

guttersstringnull

The minimum space on either side of the content

intrinsicbooleanfalse

Center child elements based on their content width

maxstringvar(--measure)

The maximum width of the centered element

Example

import React from "react";
import { Page, Stack, ZBox, Center, Text } from "zmp-ui";

export default function HomePage() {
  return (
    <Page className='section-container'>
      <Center gutter='2rem'>
        <Stack space='2rem'>
          <div style={{ border: "solid 2px", height: "100px" }} />
          <div style={{ border: "solid 2px", height: "100px" }} />
          <div style={{ border: "solid 2px", height: "100px" }} />
          <div style={{ border: "solid 2px", height: "100px" }} />
        </Stack>
      </Center>
    </Page>
  );
}