Chuyển tới nội dung chính

Box

import { Box } from "zmp-ui";

Dùng để làm wrapper để bọc các element giúp thêm khoảng cách giữa các element một cách dễ dàng theo spacing system của Zalo Mini App, hoặc tạo nhanh flex layout.

Ví dụ

Bảng thuộc tính

PropertyTypeRequiredDescription
noSpacebooleanNoCác element sẽ có `margin: 0` và `padding: 0` (default: false)
inlinebooleanNoNhận giá trị `true` nếu muốn các element inline block (default: false)
mnumberNoGiá trị margin của box, nhận giá trị là level từ 0 đến 10, với giá trị margin tương ứng là level x 4px
pnumberNoGiá trị padding của box, nhận giá trị là level từ 0 đến 10, với giá trị padding tương ứng là level x 4px
mtnumberNoGiá trị margin top
mlnumberNoGiá trị margin left
mbnumberNoGiá trị margin bottom
mrnumberNoGiá trị margin right
ptnumberNoGiá trị padding top
plnumberNoGiá trị padding left
pbnumberNoGiá trị padding bottom
prnumberNoGiá trị padding right
mxnumberNoGiá trị margin left và margin right
mynumberNoGiá trị margin top và margin bottom
pxnumberNoGiá trị padding left và padding right
pynumberNoGiá trị padding top và padding bottom
widthnumberNoChiều rộng của box
heightnumberNoChiều dài của box
verticalAlign'baseline' | 'sub' | 'super' | 'top' | 'text-top' | 'middle' | 'bottom' | 'text-bottom' | 'initial' | 'inherit'NoGiá trị vertical-align
textAlign'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit'NoGiá trị text-align
flexbooleanNoChuyển box sang flex layout (default: false)
flexDirection'row' | 'row-reverse' | 'column' | 'column-reverse'NoGiá trị flex-direction
flexWrapbooleanNoGiá trị flex-wrap (default: false)
justifyContent'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'initial'NoGiá trị justify-content
alignItems'flex-start' | 'flex-end' | 'stretch' | 'baseline' | 'center' | 'initial'NoGiá trị align-items
alignContent'stretch' | 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly' | 'initial'NoGiá trị align-content
childrenReact.ReactNodeNoReactNode