Skip to content
You are viewing documentation for v7.0.2. Switch to latest (main).

ftxui::MenuOption ​

cpp
#include <ftxui/component/component_options.hpp>

Option for the Menu component.

Examples: component/homescreen, component/menu, component/menu2, component/menu_in_frame_horizontal, component/menu_style, component/menu_underline_animated_gallery

Summary ​

SymbolDescription
entries
selectedThe list of entries.
underlineThe index of the selected entry.
entries_option
direction
elements_prefix
elements_infix
elements_postfix
on_change
on_enterCalled when the selected entry changes.
focused_entryCalled when the user presses enter.
HorizontalStandard options for a horizontal menu. This can be useful to implement a tab bar.
HorizontalAnimatedStandard options for an animated horizontal menu. This can be useful to implement a tab bar.
VerticalStandard options for a vertical menu. This can be useful to implement a list of selectable items.
VerticalAnimatedStandard options for an animated vertical menu. This can be useful to implement a list of selectable items.
ToggleStandard options for a horizontal menu with some separator. This can be useful to implement a tab bar.

Public Attributes ​

entries ​

cpp
ConstStringListRef entries;

selected ​

cpp
Ref< int > selected = 0;

The list of entries.

underline ​

cpp
UnderlineOption underline;

The index of the selected entry.

entries_option ​

cpp
MenuEntryOption entries_option;

direction ​

cpp
Direction direction = Direction::Down;

elements_prefix ​

cpp
std::function< Element()> elements_prefix;

elements_infix ​

cpp
std::function< Element()> elements_infix;

elements_postfix ​

cpp
std::function< Element()> elements_postfix;

on_change ​

cpp
std::function< void()> on_change;

on_enter ​

cpp
std::function< void()> on_enter;

Called when the selected entry changes.

Examples: component/menu

focused_entry ​

cpp
Ref< int > focused_entry = 0;

Called when the user presses enter.

Static Functions ​

Horizontal ​

cpp
static MenuOption Horizontal();

Standard options for a horizontal menu. This can be useful to implement a tab bar.

Examples: component/button, component/button_animated, component/button_style, component/canvas_animated, component/composition, component/dropdown, component/dropdown_custom, component/flexbox_gallery, component/homescreen, component/input_style, component/menu2, component/menu_in_frame_horizontal (+7 more)

HorizontalAnimated ​

Standard options for an animated horizontal menu. This can be useful to implement a tab bar.

Vertical ​

cpp
static MenuOption Vertical();

Standard options for a vertical menu. This can be useful to implement a list of selectable items.

Examples: component/button, component/button_in_frame, component/button_style, component/checkbox, component/checkbox_in_frame, component/collapsible, component/dropdown, component/flexbox_gallery, component/focus, component/focus_cursor, component/gallery, component/homescreen (+19 more)

VerticalAnimated ​

Standard options for an animated vertical menu. This can be useful to implement a list of selectable items.

Toggle ​

cpp
static MenuOption Toggle();

Standard options for a horizontal menu with some separator. This can be useful to implement a tab bar.

Examples: component/gallery, component/menu_style, component/tab_horizontal, component/toggle