Skip to Content

Box

Box 是 Ansiq 最简单的布局容器。你可以用它把子节点按列或按行排开。

Box
Box 终端效果图
Box 的终端效果图

最小示例

let layout = Box::column() .gap(1) .child(Text::new("Header").build()) .child(Paragraph::new("Body").build()) .build();

什么时候用

  • 你只想快速做 row / column
  • 你需要 children 之间的间距
  • 你不需要可见边框

关键 builder 方法

  • Box::column()
  • Box::row()
  • .gap(...)
  • .child(...).children(...)
  • .layout(...)
  • .style(...)
Last updated on