19 auto on_click = [&] { counter++; };
25 for (
int i = 0; i < 30; ++i) {
26 auto button =
Button(
"Button " + std::to_string(i), on_click, style);
27 container->Add(button);
30 auto renderer =
Renderer(container, [&] {
34 text(std::to_string(counter)),
37 container->
Render() | vscroll_indicator | frame |
44 screen.Loop(renderer);
static ButtonOption Animated()
Create a ButtonOption, using animated colors.
static ScreenInteractive FitComponent()
Component Button(ButtonOption options)
Draw a button. Execute a function when clicked.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
virtual void Render(Screen &screen)
Display an element on a ftxui::Screen.
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
Element text(std::wstring text)
Display a piece of unicode text.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element vbox(Elements)
A container displaying elements vertically one by one.
The FTXUI ftxui:: namespace.
Element hbox(Elements)
A container displaying elements horizontally one by one.