Box
box · Containers · container
The general container, the way <div> is one.
Import
cpp
#include "gbui/widgets/box.hpp"Example
cpp
Ui::Scope box(Ui& ui, const BoxOptions& options = {});Opens a container. Everything until the returned scope dies is inside it.
API
BoxOptions
| Option | Type | Default | What it does |
|---|---|---|---|
direction | Direction | Direction::Row | |
justify | Justify | Justify::Start | |
align | Align | Align::Stretch | |
gap | float | 0.0f | |
padding | Edges | ||
margin | Edges | ||
width | float | kAuto | |
height | float | kAuto | |
minWidth | float | kAuto | |
minHeight | float | kAuto | |
maxWidth | float | std::numeric_limits<float>::infinity() | |
maxHeight | float | std::numeric_limits<float>::infinity() | |
grow | float | 0.0f | |
shrink | float | 1.0f | |
basis | float | kAuto | |
background | Fill | ||
backgroundGradient | Gradient | ||
border optional | std::optional<Token> | ||
borderWidth | float | 1.0f | |
radius | float | kAuto | |
opacity | float | 1.0f | |
overflow | Overflow | Overflow::Visible | |
layer | Layer | Layer::Content | |
cursor | Cursor | Cursor::Default | |
id | std::string_view | ||
focusable | bool | false | |
role | Role | Role::None | What this container is to a reader who cannot see it. None by default, and that is the right default for the general container: most boxes are layout, and a tree full of anonymous groups is a tree a reader has to walk through rather than one they can navigate. Set it where the box is something — a Form, a List, a named Group, a Figure around a drawing. |
name | std::string_view | What it is called. A Group with no name is not worth announcing, and the tree treats it as though the role were None. |