组件
堆叠布局
以一致的间距将子元素排列成行或列。
用法
基础
One
Two
Three
HTML
<bs:bsui-stack direction="row" gap="3" align="center" justify="center">
<bs:bsui-badge label="One" />
<bs:bsui-badge label="Two" />
<bs:bsui-badge label="Three" />
</bs:bsui-stack>全宽列
拉伸的子元素会填满这一行,因此堆叠的按钮大小一致。
HTML
<bs:bsui-stack direction="column" gap="3" align="stretch">
<bs:bsui-button label="Start the free trial" />
<bs:bsui-button label="Talk to sales" variant="outline" />
</bs:bsui-stack>拆分行
两端对齐会将操作项推到行的最右侧。
3 of 25 sites in use
HTML
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="3 of 25 sites in use" variant="muted" />
<bs:bsui-button label="Add site" variant="outline" size="sm" />
</bs:bsui-stack>居中的空状态
列会沿交叉轴居中,而列默认不会这样做。
No deployments yet
Push to the main branch and the first build starts on its own.
HTML
<bs:bsui-stack direction="column" gap="4" align="center">
<bs:bsui-text content="No deployments yet" variant="title" tag="h3" />
<bs:bsui-text content="Push to the main branch and the first build starts on its own." variant="muted" />
<bs:bsui-button label="Read the guide" variant="outline" />
</bs:bsui-stack>属性
| 属性 | 类型 | 默认 |
|---|---|---|
direction | row | |
gap | 2 | |
align | — | |
justify | — | |
wrap | toggle | false |
grow | toggle | false |