Skip to Content
文档

换行

用于在元素之间添加空格,如果空间不足则自动换行。

Source
Badge 1Badge 2Badge 3

用法

¥Usage

默认情况下,Wrapdisplay: flexflex-wrap: wrapgap: 8px 应用于其子项。

¥By default, Wrap applies display: flex, flex-wrap: wrap, and gap: 8px to its children.

import { Wrap, WrapItem } from "@chakra-ui/react"
<Wrap>
  <div />
  <div />
</Wrap>

示例

¥Examples

间隙或间距

¥Gap or Spacing

传递 gap 属性,即使子组件换行,也能在每个子组件之间应用一致的间距。

¥Pass the gap prop to apply a consistent spacing between each child, even if it wraps.

对齐

¥Alignment

传递 align 属性以更改子组件沿横轴的对齐方式。

¥Pass the align prop to change the alignment of the child along the cross axis.

Box 1
Box 2
Box 3
Box 4
Box 5

对齐

¥Justify

传递 justify 属性以更改子组件沿主轴的对齐方式。

¥Pass the justify prop to change the alignment of the child along the main axis.

Box 1
Box 2
Box 3
Box 4
Box 5

行列间距

¥Row and Column Gap

传递 rowGapcolumnGap 属性,以在行和列之间应用一致的间距。

¥Pass the rowGap and columnGap props to apply a consistent spacing between the rows and columns.

响应式

¥Responsive

gaprowGapcolumnGap 属性使用响应式值,以便在每个子项之间应用响应式间距。

¥Use responsive values for the gap, rowGap, and columnGap props to apply responsive spacing between each child.

Previous

堆叠

Next

块引用