Skip to Content

Box

Box is the simplest layout container in Ansiq. Use it to stack children vertically or horizontally.

Box
Box terminal preview
Terminal preview of Box

Smallest example

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

Use Box when

  • you need a row or column quickly
  • you want spacing between children
  • you do not need a visible frame

Key builder methods

  • Box::column()
  • Box::row()
  • .gap(...)
  • .child(...), .children(...)
  • .layout(...)
  • .style(...)

Common combinations

  • Box + Block when the group also needs a border
  • Box + Input + Paragraph for simple forms
Last updated on