Skip to content

Checkbox

checkbox · Elements · interactive

A checkbox.

Import

cpp
#include "gbui/widgets/checkbox.hpp"

Example

Nothing is downloaded until you press it.

cpp
[[nodiscard]] bool checkbox(Ui& ui, const Interaction& input, std::string_view id, bool checked, const CheckboxOptions& options = {});

Returns true on the frame the user toggled it.

API

CheckboxOptions

OptionTypeDefaultWhat it does
disabledboolfalse
labelstd::string_viewDrawn to the right of the box; empty draws the box alone.
namestd::string_viewWhat a reader is told this is, when the label is not it. The label by default, which is right whenever there is one. Needed where the words are drawn beside the control rather than by it — a row that lays out its own caption and passes an empty label — because then there is nothing for the control to borrow and "switch, on" is all a reader gets.
sizefloat0.0fZero takes the active design's box size and corner.

Released under the LGPL-3.0-or-later licence.