Skip to content
You are viewing documentation for v2.0.0. Switch to latest (main).

Module ftxui/dom ​

Classes & Structs ​

ClassDescription
ftxui::Canvas
ftxui::FlexboxConfig
ftxui::Node
ftxui::Requirement
ftxui::Table
ftxui::TableSelection

Enumerations ​

BorderStyle ​

cpp
enum BorderStyle { LIGHT, HEAVY, DOUBLE, ROUNDED, EMPTY };

Constraint ​

cpp
enum Constraint { LESS_THAN, EQUAL, GREATER_THAN };

Direction ​

cpp
enum Direction { WIDTH, HEIGHT };

Examples: component/flexbox_gallery

Type Aliases ​

Decorator ​

cpp
using Decorator = std::function< Element(Element)>;

Examples: component/menu_entries

Element ​

cpp
using Element = std::shared_ptr< Node >;

Examples: component/focus, component/modal_dialog, component/slider_rgb, dom/package_manager, dom/spinner, dom/window

Elements ​

cpp
using Elements = std::vector< Element >;

Examples: component/focus, component/homescreen, component/print_key_press, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV, dom/color_truecolor_RGB, dom/size

GraphFunction ​

cpp
using GraphFunction = std::function< std::vector< int >(int, int)>;

Functions ​

SymbolDescription
align_rightAlign an element on the right side.
bgcolorSet the background color of an element.
blinkThe text drawn alternates in between visible and hidden.
boldUse a bold font, for elements with more emphasis.
borderDraw a border around the element.
borderDoubleDraw a double border around the element.
borderEmptyDraw an empty border around the element.
borderHeavyDraw a heavy border around the element.
borderLightDraw a light border around the element.
borderRoundedDraw a rounded border around the element.
borderStyledSame as border but with different styles.
borderWithSame as border but with a constant Pixel around the element.
canvasProduce an element from a Canvas, or a reference to a Canvas.
centerCenter an element horizontally and vertically.
clear_underBefore drawing child, clear the pixels below. This is useful in.
colorSet the foreground color of an element.
dboxStack several element on top of each other.
dimUse a light font, for elements with less emphasis.
emptyElementAn element of size 0x0 drawing nothing.
fillerAn element that will take expand proportionnally to the space left in a container.
flexMake a child element to expand proportionnally to the space left in a container.
flex_growExpand if possible.
flex_shrinkMinimize if needed.
focusPositionUsed inside a frame, this force the view to be scrolled toward a a given position. The position is expressed in the numbers of cells.
focusPositionRelativeUsed inside a frame, this force the view to be scrolled toward a a given position. The position is expressed in proportion of the requested size.
frameAllow an element to be displayed inside a 'virtual' area. It size can be larger than its container. In this case only a smaller portion is displayed. The view is scrollable to make the focused element visible.
gaugeDraw a high definition progress bar.
graphDraw a graph using a GraphFunction.
gridboxA container displaying a grid of elements.
hboxA container displaying elements horizontally one by one.
hcenterCenter an element horizontally.
invertedAdd a filter that will invert the foreground and the background colors.
ComputeRequirementCompute how much space an elements needs.
RenderDisplay an element on a ftxui::Screen.
SetBoxAssign a position and a dimension to an element for drawing.
notflexMake the element not flexible.
nothingA decoration doing absolutely nothing.
operator|Compose two decorator into one.
paragraphReturn an element drawing the paragraph on multiple lines.
paragraphAlignCenterReturn an element drawing the paragraph on multiple lines, aligned on the center.
paragraphAlignJustifyReturn an element drawing the paragraph on multiple lines, aligned using a justified alignment. the center.
paragraphAlignLeftReturn an element drawing the paragraph on multiple lines, aligned on the left.
paragraphAlignRightReturn an element drawing the paragraph on multiple lines, aligned on the right.
separatorDraw a vertical or horizontal separation in between two other elements.
separatorCharacterDraw a vertical or horizontal separation in between two other elements.
separatorDoubleDraw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
separatorEmptyDraw a vertical or horizontal separation in between two other elements, using the EMPTY style.
separatorHeavyDraw a vertical or horizontal separation in between two other elements, using the HEAVY style.
separatorLightDraw a vertical or horizontal separation in between two other elements, using the LIGHT style.
separatorStyledDraw a vertical or horizontal separation in between two other elements.
sizeApply a constraint on the size of an element.
spinnerUseful to represent the effect of time and/or events. This display an ASCII art "video".
textDisplay a piece of UTF8 encoded unicode text.
underlinedMake the underlined element to be underlined.
vboxA container displaying elements vertically one by one.
vcenterCenter an element vertically.
vscroll_indicatorAdd a filter that will invert the foreground and the background colors.
vtextDisplay a piece of unicode text vertically.
windowDraw window with a title and a border around the element.
xflexExpand/Minimize if possible/needed on the X axis.
xflex_growExpand if possible on the X axis.
xflex_shrinkMinimize if needed on the X axis.
yflexExpand/Minimize if possible/needed on the Y axis.
yflex_growExpand if possible on the Y axis.
yflex_shrinkMinimize if needed on the Y axis.

align_right ​

Align an element on the right side.

Parameters:

  • child: The decorated element.

Returns: The right aligned element.

Examples: dom/table

bgcolor ​

Set the background color of an element.

Parameters:

  • color: The color of the output element.
  • child: The input element.

Returns: The output element colored.

Example

cpp
Element document = bgcolor(Color::Green, text("Success")),

Examples: component/flexbox_gallery, component/focus, component/homescreen, component/menu_style, component/slider_rgb, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV, dom/color_truecolor_RGB, dom/style_color, dom/style_gallery, dom/window

bgcolor ​

Decorate using a background color.

Parameters:

  • color: The background color to be applied.

Returns: The Decorator applying the color.

Example

cpp
Element document = text("red") | bgcolor(Color::Red);

Examples: component/flexbox_gallery, component/focus, component/homescreen, component/menu_style, component/slider_rgb, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV, dom/color_truecolor_RGB, dom/style_color, dom/style_gallery, dom/window

The text drawn alternates in between visible and hidden.

Examples: dom/style_blink, dom/style_gallery

bold ​

Use a bold font, for elements with more emphasis.

Examples: component/canvas_animated, component/flexbox_gallery, component/homescreen, component/menu2, component/menu_entries, component/menu_style, component/modal_dialog, component/renderer, dom/hflow, dom/html_like, dom/package_manager, dom/size (+5 more)

border ​

Draw a border around the element.

See also: border, borderLight, borderDouble, borderHeavy, borderEmpty, borderRounded

Add a border around an element

Example

cpp
// Use 'border' as a function...
Element document = border(text("The element"));

// ...Or as a 'pipe'.
Element document = text("The element") | border;

Output

text
┌───────────┐
│The element│
└───────────┘

Examples: component/button, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/maybe, component/menu2 (+25 more)

borderDouble ​

Draw a double border around the element.

See also: border, borderLight, borderDouble, borderHeavy, borderRounded, borderEmpty, borderStyled, borderWith

Add a border around an element

Example

cpp
// Use 'borderDouble' as a function...
Element document = borderDouble(text("The element"));

// ...Or as a 'pipe'.
Element document = text("The element") | borderDouble;

Output

text
╔══════════════╗
║The element   ║
╚══════════════╝

Examples: dom/border_style, dom/separator_style

borderEmpty ​

Draw an empty border around the element.

See also: border, borderLight, borderDouble, borderHeavy, borderRounded, borderEmpty, borderStyled, borderWith

Add a border around an element

Example

cpp
// Use 'borderRounded' as a function...
Element document = borderRounded(text("The element"));

// ...Or as a 'pipe'.
Element document = text("The element") | borderRounded;

Output

text
The element

Examples: component/with_restored_io

borderHeavy ​

Draw a heavy border around the element.

See also: border, borderLight, borderDouble, borderHeavy, borderRounded, borderEmpty, borderStyled, borderWith

Add a border around an element

Example

cpp
// Use 'borderHeavy' as a function...
Element document = borderHeavy(text("The element"));

// ...Or as a 'pipe'.
Element document = text("The element") | borderHeavy;

Output

text
┏━━━━━━━━━━━━━━┓
┃The element   ┃
┗━━━━━━━━━━━━━━┛

Examples: dom/border_style, dom/separator_style

borderLight ​

Draw a light border around the element.

See also: border, borderLight, borderDouble, borderHeavy, borderRounded, borderEmpty, borderStyled, borderWith

Add a border around an element

Example

cpp
// Use 'borderLight' as a function...
Element document = borderLight(text("The element"));

// ...Or as a 'pipe'.
Element document = text("The element") | borderLight;

Output

text
┌──────────────┐
│The element   │
└──────────────┘

Examples: dom/border_style, dom/separator_style

borderRounded ​

Draw a rounded border around the element.

See also: border, borderLight, borderDouble, borderHeavy, borderRounded, borderEmpty, borderStyled, borderWith

Add a border around an element

Example

cpp
// Use 'borderRounded' as a function...
Element document = borderRounded(text("The element"));

// ...Or as a 'pipe'.
Element document = text("The element") | borderRounded;

Output

text
╭──────────────╮
│The element   │
╰──────────────╯

Examples: dom/border_style

borderStyled ​

cpp
Decorator borderStyled(BorderStyle);

Same as border but with different styles.

See also: border

borderWith ​

Same as border but with a constant Pixel around the element.

See also: border

canvas ​

cpp
Element canvas(ConstRef< Canvas >);

Produce an element from a Canvas, or a reference to a Canvas.

Examples: component/canvas_animated, dom/canvas

canvas ​

cpp
Element canvas(int width, int height, std::function< void(Canvas &)>);

Produce an element drawing a canvas of requested size.

Parameters:

  • width: the width of the canvas.
  • height: the height of the canvas.
  • fn: a function drawing the canvas.

Examples: component/canvas_animated, dom/canvas

canvas ​

cpp
Element canvas(std::function< void(Canvas &)>);

Produce an element drawing a canvas.

Parameters:

  • fn: a function drawing the canvas.

Examples: component/canvas_animated, dom/canvas

center ​

Center an element horizontally and vertically.

Parameters:

  • child: The decorated element.

Returns: The centered element.

Examples: component/flexbox_gallery, component/focus, component/homescreen, component/modal_dialog, component/renderer, component/resizable_split, component/with_restored_io, dom/dbox, dom/separator

clear_under ​

Before drawing child, clear the pixels below. This is useful in.

See also: ftxui::dbox

Examples: component/modal_dialog

color ​

Set the foreground color of an element.

Parameters:

  • color: The color of the output element.
  • child: The input element.

Returns: The output element colored.

Example

cpp
Element document = color(Color::Green, text("Success")),

Examples: component/flexbox_gallery, component/homescreen, component/menu_entries, component/menu_style, component/renderer, dom/color_gallery, dom/color_truecolor_HSV, dom/graph, dom/html_like, dom/package_manager, dom/style_color, dom/style_gallery (+2 more)

color ​

Decorate using a foreground color.

Parameters:

  • c: The foreground color to be applied.

Returns: The Decorator applying the color.

Example

cpp
Element document = text("red") | color(Color::Red);

Examples: component/flexbox_gallery, component/homescreen, component/menu_entries, component/menu_style, component/renderer, dom/color_gallery, dom/color_truecolor_HSV, dom/graph, dom/html_like, dom/package_manager, dom/style_color, dom/style_gallery (+2 more)

dbox ​

Stack several element on top of each other.

Parameters:

  • children_: The input element.

Returns: The right aligned element.

Examples: component/modal_dialog, dom/dbox

dim ​

Use a light font, for elements with less emphasis.

Examples: component/flexbox_gallery, component/homescreen, component/menu_style, dom/hflow, dom/html_like, dom/package_manager, dom/size, dom/style_dim, dom/style_gallery, dom/vflow

emptyElement ​

An element of size 0x0 drawing nothing.

filler ​

An element that will take expand proportionnally to the space left in a container.

Examples: component/flexbox_gallery, component/homescreen, component/modal_dialog, component/with_restored_io, dom/package_manager, dom/paragraph, dom/spinner, dom/style_color, dom/vbox_hbox

flex ​

Make a child element to expand proportionnally to the space left in a container.

Examples:

cpp
hbox({
  text("left") | border ,
  text("middle") | border | flex,
  text("right") | border,
});

Output:

text
┌────┐┌─────────────────────────────────────────────────────────┐┌─────┐
│left││middle                                                   ││right│
└────┘└─────────────────────────────────────────────────────────┘└─────┘

Examples: component/flexbox_gallery, component/focus, component/homescreen, component/menu_multiple, component/menu_style, dom/gauge, dom/graph, dom/separator

flex_grow ​

Expand if possible.

Examples: component/homescreen

flex_shrink ​

Minimize if needed.

focusPosition ​

cpp
Decorator focusPosition(int x, int y);

Used inside a frame, this force the view to be scrolled toward a a given position. The position is expressed in the numbers of cells.

Example

cpp
Element document = huge_document()
  | focusPosition(10, 10)
  | frame;

focusPositionRelative ​

cpp
Decorator focusPositionRelative(float x, float y);

Used inside a frame, this force the view to be scrolled toward a a given position. The position is expressed in proportion of the requested size.

For instance:

  • (0, 0) means that the view is scrolled toward the upper left.
  • (1, 0) means that the view is scrolled toward the upper right.
  • (0, 1) means that the view is scrolled toward the bottom left.

Example

cpp
Element document = huge_document()
  | focusPositionRelative(0.f, 1.f)
  | frame;

Examples: component/focus

frame ​

cpp
Element frame(Element);

Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container. In this case only a smaller portion is displayed. The view is scrollable to make the focused element visible.

See also: focus

Examples: component/checkbox, component/checkbox_in_frame, component/focus, component/homescreen, component/menu_entries, component/menu_in_frame, component/radiobox_in_frame

gauge ​

cpp
Element gauge(float ratio);

Draw a high definition progress bar.

Parameters:

  • progress: The proportion of the area to be filled. Belong to [0,1].

ExampleA gauge. It can be used to represent a progress bar.

cpp
border(gauge(0.5))

Output

text
┌──────────────────────────────────────────────────────────────────────────┐
│█████████████████████████████████████                                     │
└──────────────────────────────────────────────────────────────────────────┘

Examples: component/button, component/homescreen, component/menu2, dom/gauge, dom/package_manager

graph ​

cpp
Element graph(GraphFunction);

Draw a graph using a GraphFunction.

Parameters:

  • graph_function: the function to be called to get the data.

Examples: component/homescreen, dom/graph, dom/window

gridbox ​

cpp
Element gridbox(std::vector< Elements > lines);

A container displaying a grid of elements.

Parameters:

  • lines: A list of lines, each line being a list of elements.

Returns: The container.

Example

cpp
auto cell = [](const char* t) { return text(t) | border; };
auto document = gridbox({
  {cell("north-west") , cell("north")  , cell("north-east")} ,
  {cell("west")       , cell("center") , cell("east")}       ,
  {cell("south-west") , cell("south")  , cell("south-east")} ,
});

Output:

text
╭──────────╮╭──────╮╭──────────╮
│north-west││north ││north-east│
╰──────────╯╰──────╯╰──────────╯
╭──────────╮╭──────╮╭──────────╮
│west      ││center││east      │
╰──────────╯╰──────╯╰──────────╯
╭──────────╮╭──────╮╭──────────╮
│south-west││south ││south-east│
╰──────────╯╰──────╯╰──────────╯

Examples: component/focus, dom/gridbox

hbox ​

cpp
Element hbox(Elements);

A container displaying elements horizontally one by one.

Parameters:

  • children: The elements in the container

Returns: The container.

Example

cpp
hbox({
  text("Left"),
  text("Right"),
});

Examples: component/canvas_animated, component/collapsible, component/flexbox_gallery, component/gallery, component/homescreen, component/input, component/menu2, component/menu_entries, component/menu_style, component/modal_dialog, component/slider_rgb, component/tab_vertical (+23 more)

hcenter ​

Center an element horizontally.

Parameters:

  • child: The decorated element.

Returns: The centered element.

Examples: component/flexbox_gallery, component/homescreen, component/menu2, dom/hflow, dom/size, dom/vflow

inverted ​

Add a filter that will invert the foreground and the background colors.

Examples: component/menu_entries, dom/graph, dom/style_gallery, dom/style_inverted

ComputeRequirement ​

cpp
virtual void ComputeRequirement();

Compute how much space an elements needs.

Render ​

cpp
virtual void Render(Screen & screen);

Display an element on a ftxui::Screen.

Examples: component/button, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/maybe (+45 more)

SetBox ​

cpp
virtual void SetBox(Box box);

Assign a position and a dimension to an element for drawing.

notflex ​

Make the element not flexible.

Examples: component/flexbox_gallery

nothing ​

cpp
Element nothing(Element element);

A decoration doing absolutely nothing.

operator| ​

cpp
Decorator operator|(Decorator, Decorator);

Compose two decorator into one.

Example

cpp
auto decorator = bold | blink;

operator| ​

cpp
Elements operator|(Elements, Decorator);

From a set of element, apply a decorator to every elements.

Returns: the set of decorated element.

operator| ​

cpp
Element operator|(Element, Decorator);

From an element, apply a decorator.

Returns: the decorated element.

ExampleBoth of these are equivalent:

cpp
bold(text("Hello"));
cpp
text("Hello") | bold;

paragraph ​

cpp
Element paragraph(std::string text);

Return an element drawing the paragraph on multiple lines.

See also: flexbox

Examples: component/homescreen, component/with_restored_io, dom/html_like, dom/paragraph

paragraphAlignCenter ​

Return an element drawing the paragraph on multiple lines, aligned on the center.

See also: flexbox

Examples: component/homescreen

paragraphAlignJustify ​

Return an element drawing the paragraph on multiple lines, aligned using a justified alignment. the center.

See also: flexbox

Examples: component/homescreen

paragraphAlignLeft ​

Return an element drawing the paragraph on multiple lines, aligned on the left.

See also: flexbox

Examples: component/homescreen

paragraphAlignRight ​

Return an element drawing the paragraph on multiple lines, aligned on the right.

See also: flexbox

Examples: component/homescreen

Render ​

cpp
void Render(Screen & screen, const Element & node);

Display an element on a ftxui::Screen.

Examples: component/button, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/maybe (+45 more)

Render ​

cpp
void Render(Screen & screen, Node * node);

Display an element on a ftxui::Screen.

Examples: component/button, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/maybe (+45 more)

separator ​

cpp
Element separator(void);

Draw a vertical or horizontal separation in between two other elements.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separator(),
  text("down"),
});

Output

text
up
────
down

Examples: component/button, component/canvas_animated, component/composition, component/focus, component/gallery, component/homescreen, component/input, component/menu2, component/menu_entries, component/menu_style, component/modal_dialog, component/nested_screen (+9 more)

separator ​

Draw a separator in between two element filled with a given pixel.

See also: separator, separatorLight, separatorHeavy, separatorDouble, separatorStyled

Example

cpp
Pixel empty;
Element document = vbox({
  text("Up"),
  separator(empty),
  text("Down"),
})

Output

text
Up

Down

Examples: component/button, component/canvas_animated, component/composition, component/focus, component/gallery, component/homescreen, component/input, component/menu2, component/menu_entries, component/menu_style, component/modal_dialog, component/nested_screen (+9 more)

separatorCharacter ​

cpp
Element separatorCharacter(std::string);

Draw a vertical or horizontal separation in between two other elements.

Parameters:

  • value: the character to fill the separator area.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separator(),
  text("down"),
});

Output

text
up
────
down

separatorDouble ​

Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separatorDouble(),
  text("down"),
});

Output

text
up
════
down

Examples: dom/separator_style

separatorEmpty ​

Draw a vertical or horizontal separation in between two other elements, using the EMPTY style.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separator(),
  text("down"),
});

Output

text
up

down

separatorHeavy ​

Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separatorHeavy(),
  text("down"),
});

Output

text
up
━━━━
down

Examples: dom/separator_style

separatorLight ​

Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separatorLight(),
  text("down"),
});

Output

text
up
────
down

Examples: dom/separator_style

separatorStyled ​

cpp
Element separatorStyled(BorderStyle);

Draw a vertical or horizontal separation in between two other elements.

Parameters:

  • style: the style of the separator.

See also: separator, separatorLight, separatorDouble, separatorHeavy, separatorEmpty, separatorRounded, separatorStyled, separatorCharacter

Add a visual separation in between two elements.

Example

cpp
// Use 'border' as a function...
Element document = vbox({
  text("up"),
  separatorStyled(DOUBLE),
  text("down"),
});

Output

text
up
════
down

size ​

cpp
Decorator size(Direction, Constraint, int value);

Apply a constraint on the size of an element.

Parameters:

  • direction: Whether the WIDTH of the HEIGHT of the element must be constrained.
  • constraint: The type of constaint.
  • value: The value.

Examples: component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/menu_entries, component/menu_in_frame, component/modal_dialog, component/print_key_press, component/radiobox_in_frame (+8 more)

spinner ​

cpp
Element spinner(int charset_index, size_t image_index);

Useful to represent the effect of time and/or events. This display an ASCII art "video".

Parameters:

  • charset_index: The type of "video".
  • image_index: The "frame" of the video. You need to increase this for every "step".

Examples: component/homescreen, dom/html_like, dom/spinner

text ​

cpp
Element text(std::string text);

Display a piece of UTF8 encoded unicode text.

See also: ftxui::to_wstring

Example

cpp
Element document = text("Hello world!");

Output

text
Hello world!

Examples: component/button, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/menu2, component/menu_entries, component/menu_multiple, component/modal_dialog (+31 more)

underlined ​

Make the underlined element to be underlined.

Examples: component/canvas_animated, dom/canvas, dom/html_like, dom/style_gallery, dom/style_underlined

vbox ​

A container displaying elements vertically one by one.

Parameters:

  • children: The elements in the container

Returns: The container.

Example

cpp
vbox({
  text("Up"),
  text("Down"),
});

Examples: component/button, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/menu2, component/menu_entries, component/menu_multiple, component/modal_dialog, component/nested_screen (+21 more)

vcenter ​

Center an element vertically.

Parameters:

  • child: The decorated element.

Returns: The centered element.

vscroll_indicator ​

Add a filter that will invert the foreground and the background colors.

Examples: component/checkbox, component/checkbox_in_frame, component/homescreen, component/menu_in_frame, component/radiobox_in_frame

vtext ​

cpp
Element vtext(std::string text);

Display a piece of unicode text vertically.

See also: ftxui::to_wstring

Example

cpp
Element document = vtext("Hello world!");

Output

text
H
e
l
l
o

w
o
r
l
d
!

window ​

cpp
Element window(Element title, Element content);

Draw window with a title and a border around the element.

Parameters:

  • title: The title of the window.
  • content: The element to be wrapped.

See also: border

Example

cpp
Element document = window(text("Title"),
                          text("content")
                   );

Output

text
┌Title──┐
│content│
└───────┘

Examples: component/flexbox_gallery, component/homescreen, component/menu_multiple, component/print_key_press, dom/color_truecolor_RGB, dom/hflow, dom/package_manager, dom/size, dom/vflow

xflex ​

Expand/Minimize if possible/needed on the X axis.

Examples: component/gallery, component/slider_rgb

xflex_grow ​

Expand if possible on the X axis.

Examples: component/flexbox_gallery

xflex_shrink ​

Minimize if needed on the X axis.

yflex ​

Expand/Minimize if possible/needed on the Y axis.

yflex_grow ​

Expand if possible on the Y axis.

Examples: component/flexbox_gallery

yflex_shrink ​

Minimize if needed on the Y axis.