examples/component/dropdown_custom.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<string>//forbasic_string,string,allocator
    #include<vector>//forvector

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forDropdown,Horizontal,Vertical
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive

    intmain(){
    usingnamespaceftxui;

    std::vector<std::string>entries={
    "tribute","clearance","ally","bend","electronics",
    "module","era","cultural","sniff","nationalism",
    "negotiation","deliver","figure","east","tribute",
    "clearance","ally","bend","electronics","module",
    "era","cultural","sniff","nationalism","negotiation",
    "deliver","figure","east","tribute","clearance",
    "ally","bend","electronics","module","era",
    "cultural","sniff","nationalism","negotiation","deliver",
    "figure","east",
    };

    autodropdown_1=Dropdown({
    .radiobox={.entries=&entries},
    .transform=
    [](boolopen,Elementcheckbox,Elementradiobox){
    if(open){
    returnvbox({
    checkbox|inverted,
    radiobox|vscroll_indicator|frame|
    size(HEIGHT,LESS_THAN,10),
    filler(),
    });
    }
    returnvbox({
    checkbox,
    filler(),
    });
    },
    });

    autodropdown_2=Dropdown({
    .radiobox={.entries=&entries},
    .transform=
    [](boolopen,Elementcheckbox,Elementradiobox){
    if(open){
    returnvbox({
    checkbox|inverted,
    radiobox|vscroll_indicator|frame|
    size(HEIGHT,LESS_THAN,10)|bgcolor(Color::Blue),
    filler(),
    });
    }
    returnvbox({
    checkbox|bgcolor(Color::Blue),
    filler(),
    });
    },
    });

    autodropdown_3=Dropdown({
    .radiobox=
    {
    .entries=&entries,
    .transform=
    [](constEntryState&s){
    autot=text(s.label)|borderEmpty;
    if(s.active){
    t|=bold;
    }
    if(s.focused){
    t|=inverted;
    }
    returnt;
    },
    },
    .transform=
    [](boolopen,Elementcheckbox,Elementradiobox){
    checkbox|=borderEmpty;
    if(open){
    returnvbox({
    checkbox|inverted,
    radiobox|vscroll_indicator|frame|
    size(HEIGHT,LESS_THAN,20)|bgcolor(Color::Red),
    filler(),
    });
    }
    returnvbox({
    checkbox|bgcolor(Color::Red),
    filler(),
    });
    },
    });

    autoscreen=ScreenInteractive::FitComponent();
    screen.Loop(Container::Horizontal({
    dropdown_1,
    dropdown_2,
    dropdown_3,
    }));
    }