Banner
banner · Elements · interactive
A message that stays, in the flow, where the thing it is about is.
Import
cpp
#include "gbui/widgets/banner.hpp"Example
Nothing is downloaded until you press it.
cpp
BannerResult banner(Ui& ui, const Interaction& input, std::string_view id, std::string_view title, const BannerOptions& options = {});A message in the flow. Danger and Warning take ARIA's alert, which interrupts a screen reader mid-sentence; Info and Success take status, which waits for a pause. That difference is the whole reason the kind is not just a colour: a conflict a reader has to know about now and a note they can hear in a moment are not the same message.
API
BannerOptions
| Option | Type | Default | What it does |
|---|---|---|---|
kind | BannerKindInfo · Success · Warning · Danger | BannerKind::Info | How much attention it is owed — and therefore whether a screen reader is interrupted by it. See BannerKind. |
detail | std::string_view | A second line under the title, for the part that does not fit in one. | |
icon optional | std::optional<Icon> | Overrides the glyph the kind would pick. | |
closable | bool | false | An × at the trailing edge. A banner whose condition the reader cannot clear should not have one — an × that puts the message back next frame is a control that does not work. |
action | std::string_view | The label of a single action at the trailing edge — "Resolve", "Retry", "Reload". Empty draws none. |