For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/stack.md.
v0.0.57
  • 简体中文
  • Stack

    布局@rockshin/tao-ui

    以一致间距在行或列中排列子元素。

    何时使用

    一维布局与间距不值得单独编写 CSS 时使用 Stack。

    推荐

    • 优先使用 Stack 代替重复 margin。
    • 响应式方向使用断点映射。

    避免

    • 具有更丰富语义的布局应使用对应容器。

    代码演示

    基础用法

    DesignEngineeringResearch
    TSX

    方向、间距与对齐

    Small gapCentered
    Large gapEnd aligned
    TSX

    响应式方向

    TSX

    主轴与交叉轴对齐

    用 align 和 root 的 justifyContent 调整子项位置。

    Centered vertically
    TSX

    自然换行

    在语义 root 上启用 flexWrap,长工具栏可换行而不撑破页面。

    TSX

    断点方向与间距

    窄视口纵向排列,较宽视口切换为横向;可用手机预览对比。

    390 × 640
    TSX

    嵌套组织布局

    外层负责区块间距,内层负责相关操作的排列。

    Workspace

    Invite members and manage access.

    TSX

    API

    Stack

    属性说明类型默认值
    directionFlex direction. Accepts a breakpoint map, e.g. direction={{ xs: 'vertical', md: 'horizontal' }} — the largest matching breakpoint wins (SSR/first render falls back to the plain default).TaoResponsiveValue<StackDirection> | undefinedvertical
    className节点类名string | undefined-
    style节点样式CSSProperties | undefined-