examples/component/button_in_frame.cpp

    //Copyright2022ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<memory>//forallocator,__shared_ptr_access,shared_ptr
    #include<string>//forto_string,operator+

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forButton,Renderer,Vertical
    #include"ftxui/component/component_base.hpp"//forComponentBase
    #include"ftxui/component/component_options.hpp"//forButtonOption
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive
    #include"ftxui/dom/elements.hpp"//foroperator|,text,Element,hbox,separator,size,vbox,border,frame,vscroll_indicator,HEIGHT,LESS_THAN
    #include"ftxui/screen/color.hpp"//forColor,Color::Default,Color::GrayDark,Color::White

    usingnamespaceftxui;

    intmain(){
    intcounter=0;
    autoon_click=[&]{counter++;};

    autostyle=ButtonOption::Animated(Color::Default,Color::GrayDark,
    Color::Default,Color::White);

    autocontainer=Container::Vertical({});
    for(inti=0;i<30;++i){
    autobutton=Button("Button"+std::to_string(i),on_click,style);
    container->Add(button);
    }

    autorenderer=Renderer(container,[&]{
    returnvbox({
    hbox({
    text("Counter:"),
    text(std::to_string(counter)),
    }),
    separator(),
    container->Render()|vscroll_indicator|frame|
    size(HEIGHT,LESS_THAN,20),
    })|
    border;
    });

    autoscreen=ScreenInteractive::FitComponent();
    screen.Loop(renderer);

    return0;
    }