Modal
Overlays · interactive
A modal dialog, with a backdrop and a header you can drag it by.
Import
cpp
#include "gbui/widgets/modal.hpp"Example
Modal
modal · Overlays · interactive
cpp
Modal modal(Ui& ui, const Interaction& input, std::string_view id, std::string_view title, Vec2 position, const ModalOptions& options = {});The caller supplies the position so dragging survives the tree being rebuilt, and gets it back updated.
ModalActions
modalActions · Overlays · container
cpp
Ui::Scope modalActions(Ui& ui);The row of buttons at the foot of a dialog, pushed to the right.
API
ModalOptions
| Option | Type | Default | What it does |
|---|---|---|---|
width | float | 420.0f | |
height | float | kAuto | |
backdrop | bool | true | Dims what is behind it. A modal without one is a floating panel. |
draggable | bool | true | Lets the user drag it by its header, kept inside the window. |
icon optional | std::optional<Icon> | Beside the title. A dialog that asks something usually wants one; one that reports something usually does not. | |
danger | bool | false | The destructive kind. Recolours the title, and takes AlertDialog in the accessibility tree — which is what tells a reader they were interrupted rather than that they asked. |