examples/component/button_style.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<string>//foroperator+,to_string

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forButton,Vertical,Renderer,Horizontal,operator|
    #include"ftxui/component/component_base.hpp"//forComponent
    #include"ftxui/component/component_options.hpp"//forButtonOption
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive
    #include"ftxui/dom/elements.hpp"//forElement,separator,text,border
    #include"ftxui/screen/color.hpp"//forColor,Color::Blue,Color::Green,Color::Red

    usingnamespaceftxui;

    intmain(){
    intvalue=0;
    autoaction=[&]{value++;};
    autoaction_renderer=
    Renderer([&]{returntext("count="+std::to_string(value));});

    autobuttons=
    Container::Vertical({
    action_renderer,
    Renderer([]{returnseparator();}),
    Container::Horizontal({
    Container::Vertical({
    Button("Ascii1",action,ButtonOption::Ascii()),
    Button("Ascii2",action,ButtonOption::Ascii()),
    Button("Ascii3",action,ButtonOption::Ascii()),
    }),
    Renderer([]{returnseparator();}),
    Container::Vertical({
    Button("Simple1",action,ButtonOption::Simple()),
    Button("Simple2",action,ButtonOption::Simple()),
    Button("Simple3",action,ButtonOption::Simple()),
    }),
    Renderer([]{returnseparator();}),
    Container::Vertical({
    Button("Animated1",action,ButtonOption::Animated()),
    Button("Animated2",action,ButtonOption::Animated()),
    Button("Animated3",action,ButtonOption::Animated()),
    }),
    Renderer([]{returnseparator();}),
    Container::Vertical({
    Button("Animated4",action,
    ButtonOption::Animated(Color::Red)),
    Button("Animated5",action,
    ButtonOption::Animated(Color::Green)),
    Button("Animated6",action,
    ButtonOption::Animated(Color::Blue)),
    }),
    }),
    })|
    border;

    autoscreen=ScreenInteractive::FitComponent();
    screen.Loop(buttons);
    return0;
    }