Skip to content

Commit

Permalink
Add missing Checkbox() implementation (#796)
Browse files Browse the repository at this point in the history
Fix: #795
  • Loading branch information
ParticleG authored and ArthurSonzogni committed Dec 26, 2024
1 parent 1d797ee commit aceabdb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/ftxui/component/checkbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ class CheckboxBase : public ComponentBase, public CheckboxOption {
};
} // namespace

/// @brief Draw checkable element.
/// @param option Additional optional parameters.
/// @ingroup component
/// @see CheckboxBase
///
/// ### Example
///
/// ```cpp
/// auto screen = ScreenInteractive::FitComponent();
/// CheckboxOption option;
/// option.label = "Make a sandwidth";
/// option.checked = false;
/// Component checkbox = Checkbox(option);
/// screen.Loop(checkbox)
/// ```
///
/// ### Output
///
/// ```bash
/// ☐ Make a sandwitch
/// ```
// NOLINTNEXTLINE
Component Checkbox(CheckboxOption option) {
return Make<CheckboxBase>(std::move(option));
}

/// @brief Draw checkable element.
/// @param label The label of the checkbox.
/// @param checked Whether the checkbox is checked or not.
Expand Down

0 comments on commit aceabdb

Please sign in to comment.