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

Module ftxui/dom ​

Classes & Structs ​

ClassDescription
ftxui::Canvas
ftxui::FlexboxConfig
ftxui::LinearGradientA class representing the settings for linear-gradient color effect.
ftxui::LinearGradient::Stop
ftxui::Node
ftxui::Requirement
ftxui::SelectionRepresent a selection in the terminal.
ftxui::Table
ftxui::TableSelection

Enumerations ​

BorderStyle ​

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

Constraint ​

cpp
enum Constraint { LESS_THAN, EQUAL, GREATER_THAN };

Direction ​

cpp
enum Direction { Up, Down, Left, Right };

Examples: component/flexbox_gallery, component/scrollbar, component/slider_direction

WidthOrHeight ​

cpp
enum WidthOrHeight { WIDTH, HEIGHT };

Type Aliases ​

Decorator ​

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

Examples: component/focus_cursor

Element ​

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

Examples: component/dropdown_custom, component/focus, component/menu_entries, component/menu_style, component/modal_dialog, component/modal_dialog_custom, component/selection, component/slider_rgb, dom/package_manager, dom/spinner

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.
automergeEnable character to be automatically merged with others nearby.
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.
borderDashedDraw a dashed 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 proportionally to the space left in a container.
flexMake a child element to expand proportionally to the space left in a container.
flex_growExpand if possible.
flex_shrinkMinimize if needed.
SetSet the flexbox direction.
SetGapSet the flexbox flex direction.
focusSet the child to be the one focused among its siblings.
focusCursorBarSame as focus, but set the cursor shape to be a still block.
focusCursorBarBlinkingSame as focus, but set the cursor shape to be a blinking bar.
focusCursorBlockSame as focus, but set the cursor shape to be a still block.
focusCursorBlockBlinkingSame as focus, but set the cursor shape to be a blinking block.
focusCursorUnderlineSame as focus, but set the cursor shape to be a still underline.
focusCursorUnderlineBlinkingSame as focus, but set the cursor shape to be a blinking underline.
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.
gaugeDirectionDraw a high definition progress bar progressing in specified direction.
gaugeDownDraw a high definition progress bar progressing from top to bottom.
gaugeLeftDraw a high definition progress bar progressing from right to left.
gaugeRightDraw a high definition progress bar progressing from left to right.
gaugeUpDraw a high definition progress bar progressing from bottom to top.
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.
hscroll_indicatorDisplay an horizontal scrollbar to the bottom. colors.
hyperlinkMake the rendered area clickable using a web browser. The link will be opened when the user click on it. This is supported only on a limited set of terminal emulator. List: https://github.com/Alhadis/OSC8-Adoption/.
invertedAdd a filter that will invert the foreground and the background colors.
italicApply a underlinedDouble to text.
AngleSet the angle of the gradient.
LinearGradientBuild the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example:
StopAdd a color stop to the gradient.
ComputeRequirementCompute how much space an elements needs.
RenderDisplay an element on a ftxui::Screen.
SelectCompute the selection of an element.
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.
operator|=Apply a decorator to an element.
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.
selectSet the child to be the one focused among its siblings.
selectionBackgroundColorSet the background color of an element when selected. Note that the style is applied on top of the existing style.
selectionColorSet the color of an element when selected.
selectionForegroundColorSet the foreground color of an element when selected. Note that the style is applied on top of the existing style.
selectionStyleSet the style of an element when selected.
selectionStyleResetReset the selection style of an element.
separatorDraw a vertical or horizontal separation in between two other elements.
separatorCharacterDraw a vertical or horizontal separation in between two other elements.
separatorDashedDraw a vertical or horizontal separation in between two other elements, using the DASHED style.
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.
separatorHSelectorDraw an horizontal bar, with the area in between left/right colored differently.
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.
separatorVSelectorDraw an vertical bar, with the area in between up/downcolored differently.
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".
strikethroughApply a strikethrough to text.
SelectAllSelect all the table.
SelectCellSelect a cell of the table.
SelectColumnSelect a column of the table.
SelectColumnsSelect a range of columns of the table.
SelectRectangleSelect a rectangle of the table.
SelectRowSelect a row of the table.
SelectRowsSelect a range of rows of the table.
TableCreate an empty table.
BorderApply a border around the selection.
BorderBottomDraw some separator lines to the bottom side of the selection.
BorderLeftDraw some separator lines to the left side of the selection.
BorderRightDraw some separator lines to the right side of the selection.
BorderTopDraw some separator lines to the top side of the selection.
DecorateApply the decorator to the selection. This decorate both the cells, the lines and the corners.
DecorateAlternateColumnApply the decorator to the selection. This decorate only the lines modulo modulo with a shift of shift.
DecorateAlternateRowApply the decorator to the selection. This decorate only the lines modulo modulo with a shift of shift.
DecorateCellsApply the decorator to the selection.
DecorateCellsAlternateColumnApply the decorator to the selection. This decorate only the corners modulo modulo with a shift of shift.
DecorateCellsAlternateRowApply the decorator to the selection. This decorate only the corners modulo modulo with a shift of shift.
SeparatorDraw some separator lines in the selection.
SeparatorHorizontalDraw some horizontal separator lines in the selection.
SeparatorVerticalDraw some vertical separator lines in the selection.
textDisplay a piece of UTF8 encoded unicode text.
underlinedMake the underlined element to be underlined.
underlinedDoubleApply a underlinedDouble to text.
vboxA container displaying elements vertically one by one.
vcenterCenter an element vertically.
vscroll_indicatorDisplay a vertical scrollbar to the right. 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.
xframeSame as frame, but only 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.
yframeSame as frame, but only 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

automerge ​

Enable character to be automatically merged with others nearby.

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/dropdown_custom, component/flexbox_gallery, component/focus, component/homescreen, component/input_style, component/linear_gradient_gallery, component/menu_entries_animated, component/menu_style, component/slider_rgb, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV (+4 more)

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/dropdown_custom, component/flexbox_gallery, component/focus, component/homescreen, component/input_style, component/linear_gradient_gallery, component/menu_entries_animated, component/menu_style, component/slider_rgb, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV (+4 more)

bgcolor ​

Set the background color of an element with linear-gradient effect.

Parameters:

  • gradient: The gradient effect to be applied on the output element.
  • child: The input element.

Returns: The output element colored.

Example

cpp
bgcolor(LinearGradient{0, {Color::Red, Color::Blue}}, text("Hello"))

Examples: component/dropdown_custom, component/flexbox_gallery, component/focus, component/homescreen, component/input_style, component/linear_gradient_gallery, component/menu_entries_animated, component/menu_style, component/slider_rgb, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV (+4 more)

bgcolor ​

Decorate using a linear-gradient effect on the background color.

Parameters:

  • gradient: The gradient effect to be applied on the output element.

Returns: The Decorator applying the color.

Example

cpp
text("Hello") | color(LinearGradient{0, {Color::Red, Color::Blue}})

Examples: component/dropdown_custom, component/flexbox_gallery, component/focus, component/homescreen, component/input_style, component/linear_gradient_gallery, component/menu_entries_animated, component/menu_style, component/slider_rgb, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV (+4 more)

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/dropdown_custom, component/flexbox_gallery, component/homescreen, component/menu2, component/menu_entries, component/menu_style, component/modal_dialog_custom, component/renderer, dom/hflow, dom/html_like, dom/package_manager (+6 more)

border ​

Draw a border around the element.

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

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_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/checkbox_in_frame, component/composition, component/custom_loop, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input (+34 more)

borderDashed ​

Draw a dashed border around the element.

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

Add a border around an element

Example

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

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

Output

text
┏╍╍╍╍╍╍╍╍╍╍╍╍╍╍┓
╏The element   ╏
┗╍╍╍╍╍╍╍╍╍╍╍╍╍╍┛

Examples: dom/border_style, dom/separator_style

borderDouble ​

Draw a double border around the element.

See also: border, borderLight, borderDashed, 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: component/input_style, component/menu_style, dom/border_style, dom/separator_style

borderEmpty ​

Draw an empty border around the element.

See also: border, borderLight, borderDashed, 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/dropdown_custom, component/input_style, component/menu_underline_animated_gallery, component/with_restored_io

borderHeavy ​

Draw a heavy border around the element.

See also: border, borderLight, borderDashed, 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, borderDashed, 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, borderDashed, 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/input_style, dom/border_style

borderStyled ​

cpp
Decorator borderStyled(BorderStyle);

Same as border but with different styles.

See also: border

Examples: dom/border_colored

borderStyled ​

Same as border but with a foreground color.

See also: border

Examples: dom/border_colored

borderStyled ​

cpp
Decorator borderStyled(BorderStyle, Color);

Same as border but with a foreground color and a different style.

See also: border

Examples: dom/border_colored

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/input_style, component/linear_gradient_gallery, component/modal_dialog, component/modal_dialog_custom, component/renderer, component/resizable_split, component/with_restored_io, dom/dbox, dom/gauge_direction (+2 more)

clear_under ​

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

See also: ftxui::dbox

Examples: component/modal_dialog_custom

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/input_style, component/linear_gradient_gallery, component/maybe, component/menu_entries, component/menu_style, component/renderer, dom/border_colored, dom/color_gallery, dom/color_truecolor_HSV, dom/graph (+5 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/input_style, component/linear_gradient_gallery, component/maybe, component/menu_entries, component/menu_style, component/renderer, dom/border_colored, dom/color_gallery, dom/color_truecolor_HSV, dom/graph (+5 more)

color ​

Set the foreground color of an element with linear-gradient effect.

Parameters:

  • gradient: The gradient effect to be applied on the output element.
  • child: The input element.

Returns: The output element colored.

Example

cpp
color(LinearGradient{0, {Color::Red, Color::Blue}}, text("Hello"))

Examples: component/flexbox_gallery, component/homescreen, component/input_style, component/linear_gradient_gallery, component/maybe, component/menu_entries, component/menu_style, component/renderer, dom/border_colored, dom/color_gallery, dom/color_truecolor_HSV, dom/graph (+5 more)

color ​

Decorate using a linear-gradient effect on the foreground color.

Parameters:

  • gradient: The gradient effect to be applied on the output element.

Returns: The Decorator applying the color.

Example

cpp
text("Hello") | color(LinearGradient{0, {Color::Red, Color::Blue}})

Examples: component/flexbox_gallery, component/homescreen, component/input_style, component/linear_gradient_gallery, component/maybe, component/menu_entries, component/menu_style, component/renderer, dom/border_colored, dom/color_gallery, dom/color_truecolor_HSV, dom/graph (+5 more)

dbox ​

Stack several element on top of each other.

Parameters:

  • children_: The input element.

Returns: The right aligned element.

Examples: component/modal_dialog_custom, dom/dbox

dim ​

Use a light font, for elements with less emphasis.

Examples: component/flexbox_gallery, component/homescreen, component/input_style, 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 proportionally to the space left in a container.

Examples: component/dropdown_custom, component/flexbox_gallery, component/homescreen, component/menu_style, component/modal_dialog_custom, component/with_restored_io, dom/gauge_direction, dom/package_manager, dom/paragraph, dom/spinner, dom/style_color, dom/vbox_hbox

flex ​

Make a child element to expand proportionally 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/linear_gradient_gallery, component/menu_multiple, component/menu_style, component/scrollbar, component/textarea, dom/gauge, dom/graph, dom/separator

flex_grow ​

Expand if possible.

Examples: component/homescreen

flex_shrink ​

Minimize if needed.

Set ​

Set the flexbox direction.

Examples: component/flexbox_gallery, component/menu_style

Set ​

Set the flexbox wrap.

Examples: component/flexbox_gallery, component/menu_style

Set ​

Set the flexbox justify content.

Examples: component/flexbox_gallery, component/menu_style

Set ​

Set the flexbox align items.

Examples: component/flexbox_gallery, component/menu_style

Set ​

Set the flexbox align content.

Examples: component/flexbox_gallery, component/menu_style

SetGap ​

cpp
FlexboxConfig & SetGap(int gap_x, int gap_y);

Set the flexbox flex direction.

Examples: component/homescreen

focus ​

Set the child to be the one focused among its siblings.

Parameters:

  • child: The element to be focused.

Examples: component/focus_cursor

focusCursorBar ​

Same as focus, but set the cursor shape to be a still block.

See also: focus, focusCursorBlock, focusCursorBlockBlinking, focusCursorBar, focusCursorBarBlinking, focusCursorUnderline, focusCursorUnderlineBlinking

Examples: component/focus_cursor

focusCursorBarBlinking ​

Same as focus, but set the cursor shape to be a blinking bar.

See also: focus, focusCursorBlock, focusCursorBlockBlinking, focusCursorBar, focusCursorBarBlinking, focusCursorUnderline, focusCursorUnderlineBlinking

Examples: component/focus_cursor

focusCursorBlock ​

Same as focus, but set the cursor shape to be a still block.

See also: focus, focusCursorBlock, focusCursorBlockBlinking, focusCursorBar, focusCursorBarBlinking, focusCursorUnderline, focusCursorUnderlineBlinking

Examples: component/focus_cursor

focusCursorBlockBlinking ​

Same as focus, but set the cursor shape to be a blinking block.

See also: focus, focusCursorBlock, focusCursorBlockBlinking, focusCursorBar, focusCursorBarBlinking, focusCursorUnderline, focusCursorUnderlineBlinking

Examples: component/focus_cursor

focusCursorUnderline ​

Same as focus, but set the cursor shape to be a still underline.

See also: focus, focusCursorBlock, focusCursorBlockBlinking, focusCursorBar, focusCursorBarBlinking, focusCursorUnderline, focusCursorUnderlineBlinking

Examples: component/focus_cursor

focusCursorUnderlineBlinking ​

Same as focus, but set the cursor shape to be a blinking underline.

See also: focus, focusCursorBlock, focusCursorBlockBlinking, focusCursorBar, focusCursorBarBlinking, focusCursorUnderline, focusCursorUnderlineBlinking

Examples: component/focus_cursor

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, component/scrollbar

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: frame, xframe, yframe

Examples: component/button_in_frame, component/checkbox_in_frame, component/dropdown_custom, component/focus, component/homescreen, component/input_in_frame, component/menu_entries, component/menu_entries_animated, component/menu_in_frame, component/menu_in_frame_horizontal, component/radiobox_in_frame, component/scrollbar (+1 more)

gauge ​

cpp
Element gauge(float progress);

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_animated, component/homescreen, component/menu2, dom/gauge, dom/package_manager

gaugeDirection ​

cpp
Element gaugeDirection(float progress, Direction direction);

Draw a high definition progress bar progressing in specified direction.

Parameters:

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

gaugeDown ​

cpp
Element gaugeDown(float progress);

Draw a high definition progress bar progressing from top to bottom.

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(gaugeDown(0.5))

Output

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

Examples: dom/gauge_direction

gaugeLeft ​

cpp
Element gaugeLeft(float progress);

Draw a high definition progress bar progressing from right to left.

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(gaugeLeft(0.5))

Output

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

Examples: dom/gauge_direction

gaugeRight ​

cpp
Element gaugeRight(float progress);

Draw a high definition progress bar progressing from left to right.

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.

Output

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

Examples: dom/gauge_direction

gaugeUp ​

cpp
Element gaugeUp(float progress);

Draw a high definition progress bar progressing from bottom to top.

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(gaugeUp(0.5))

Output

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

Examples: dom/gauge_direction

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

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/button_in_frame, component/canvas_animated, component/collapsible, component/flexbox_gallery, component/focus_cursor, component/gallery, component/homescreen, component/input, component/input_style, component/menu2, component/menu_entries, component/menu_entries_animated (+34 more)

hcenter ​

Center an element horizontally.

Parameters:

  • child: The decorated element.

Returns: The centered element.

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

hscroll_indicator ​

Display an horizontal scrollbar to the bottom. colors.

Examples: component/menu_in_frame_horizontal

cpp
Element hyperlink(std::string link, Element child);

Make the rendered area clickable using a web browser. The link will be opened when the user click on it. This is supported only on a limited set of terminal emulator. List: https://github.com/Alhadis/OSC8-Adoption/.

Parameters:

  • link: The link
  • child: The input element.

Returns: The output element with the link.

Example

cpp
Element document =
  hyperlink("https://github.com/ArthurSonzogni/FTXUI", "link");

Examples: dom/style_gallery, dom/style_hyperlink

cpp
Decorator hyperlink(std::string link);

Decorate using an hyperlink. The link will be opened when the user click on it. This is supported only on a limited set of terminal emulator. List: https://github.com/Alhadis/OSC8-Adoption/.

Parameters:

  • link: The link to redirect the users to.

Returns: The Decorator applying the hyperlink.

Example

cpp
Element document =
  text("red") | hyperlink("https://github.com/Arthursonzogni/FTXUI");

Examples: dom/style_gallery, dom/style_hyperlink

inverted ​

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

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

italic ​

Apply a underlinedDouble to text.

Examples: dom/style_gallery, dom/style_italic

Angle ​

cpp
LinearGradient & Angle(float angle);

Set the angle of the gradient.

Parameters:

  • a: The angle of the gradient.

Returns: The gradient.

Examples: component/linear_gradient_gallery, dom/linear_gradient

LinearGradient ​

Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example:

cpp
auto gradient =
 LinearGradient()
  .Angle(45)
  .Stop(Color::Red, 0.0)
  .Stop(Color::Green, 0.5)
  .Stop(Color::Blue, 1.0);;

Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color

LinearGradient ​

cpp
LinearGradient(Color begin, Color end);

Build a gradient with two colors.

Parameters:

  • begin: The color at the beginning of the gradient.
  • end: The color at the end of the gradient.

Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color

LinearGradient ​

cpp
LinearGradient(float angle, Color begin, Color end);

Build a gradient with two colors and an angle.

Parameters:

  • a: The angle of the gradient.
  • begin: The color at the beginning of the gradient.
  • end: The color at the end of the gradient.

Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color

Stop ​

Add a color stop to the gradient.

Parameters:

  • c: The color of the stop.

Returns: The gradient.

Note

The position of the stop is interpolated from nearby stops.

Examples: component/linear_gradient_gallery, dom/linear_gradient

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_animated, component/button_in_frame, component/canvas_animated, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/input_in_frame (+57 more)

Select ​

cpp
virtual void Select(Selection & selection);

Compute the selection of an element.

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;

operator|= ​

cpp
Element & operator|=(Element &, Decorator);

Apply a decorator to an element.

Returns: the decorated element.

ExampleBoth of these are equivalent:

cpp
auto element = text("Hello");
element |= bold;

paragraph ​

cpp
Element paragraph(const std::string & text);

Return an element drawing the paragraph on multiple lines.

See also: flexbox

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

paragraphAlignCenter ​

cpp
Element paragraphAlignCenter(const std::string & text);

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

See also: flexbox

Examples: component/homescreen

paragraphAlignJustify ​

cpp
Element paragraphAlignJustify(const std::string & text);

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

See also: flexbox

Examples: component/homescreen

paragraphAlignLeft ​

cpp
Element paragraphAlignLeft(const std::string & text);

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

See also: flexbox

Examples: component/homescreen

paragraphAlignRight ​

cpp
Element paragraphAlignRight(const std::string & text);

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 & element);

Display an element on a ftxui::Screen.

Examples: component/button_animated, component/button_in_frame, component/canvas_animated, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/input_in_frame (+57 more)

Render ​

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

Display an element on a ftxui::Screen.

Examples: component/button_animated, component/button_in_frame, component/canvas_animated, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/input_in_frame (+57 more)

select ​

cpp
Element select(Element e);

Set the child to be the one focused among its siblings.

This is deprecated. Use focus instead.

Parameters:

  • child: The element to be focused.

selectionBackgroundColor ​

cpp
Decorator selectionBackgroundColor(Color foreground);

Set the background color of an element when selected. Note that the style is applied on top of the existing style.

Examples: component/selection

selectionColor ​

cpp
Decorator selectionColor(Color foreground);

Set the color of an element when selected.

Parameters:

  • foreground: The color to be applied. Note that the style is applied on top of the existing style.

Examples: component/selection

selectionForegroundColor ​

cpp
Decorator selectionForegroundColor(Color foreground);

Set the foreground color of an element when selected. Note that the style is applied on top of the existing style.

selectionStyle ​

cpp
Decorator selectionStyle(std::function< void(Pixel &)> style);

Set the style of an element when selected.

Parameters:

  • style: The style to be applied. Note that the style is applied on top of the existing style.

Examples: component/selection

selectionStyleReset ​

cpp
Element selectionStyleReset(Element);

Reset the selection style of an element.

Parameters:

  • child: The input element.

Returns: The output element with the selection style reset.

Examples: component/selection

separator ​

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

See also: separator, separatorLight, separatorDashed, 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_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/composition, component/custom_loop, component/focus, component/gallery, component/homescreen, component/input, component/input_style, component/menu2 (+20 more)

separator ​

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

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

Example

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

Output

text
Up

Down

Examples: component/button_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/composition, component/custom_loop, component/focus, component/gallery, component/homescreen, component/input, component/input_style, component/menu2 (+20 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, separatorDashed, 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

separatorDashed ​

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

See also: separator, separatorLight, separatorDashed, 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

separatorDouble ​

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

See also: separator, separatorLight, separatorDashed, 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, separatorDashed, 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/input_style

separatorHeavy ​

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

See also: separator, separatorLight, separatorDashed, 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

separatorHSelector ​

cpp
Element separatorHSelector(float left, float right, Color unselected_color, Color selected_color);

Draw an horizontal bar, with the area in between left/right colored differently.

Parameters:

  • left: the left limit of the active area.
  • right: the right limit of the active area.
  • selected_color: the color of the selected area.
  • unselected_color: the color of the unselected area.

Example

cpp
Element document = separatorHSelector(2,5, Color::White, Color::Blue);

separatorLight ​

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

See also: separator, separatorLight, separatorDashed, 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, separatorDashed, 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

separatorVSelector ​

cpp
Element separatorVSelector(float up, float down, Color unselected_color, Color selected_color);

Draw an vertical bar, with the area in between up/downcolored differently.

Parameters:

  • up: the left limit of the active area.
  • down: the right limit of the active area.
  • selected_color: the color of the selected area.
  • unselected_color: the color of the unselected area.

Example

cpp
Element document = separatorHSelector(2,5, Color::White, Color::Blue);

size ​

cpp
Decorator size(WidthOrHeight, 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/button_in_frame, component/canvas_animated, component/checkbox_in_frame, component/dropdown_custom, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/input_in_frame, component/menu_entries, component/menu_in_frame (+15 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

strikethrough ​

Apply a strikethrough to text.

Examples: dom/style_gallery, dom/style_strikethrough

Render ​

Render the table.

Returns: The rendered table. This is an element you can draw.

Examples: component/button_animated, component/button_in_frame, component/canvas_animated, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/input_in_frame (+57 more)

SelectAll ​

Select all the table.

Examples: dom/table

SelectCell ​

cpp
TableSelection SelectCell(int column, int row);

Select a cell of the table.

Parameters:

  • column: The column of the cell to select.
  • row: The row of the cell to select.

Note

You can use negative index to select from the end.

SelectColumn ​

cpp
TableSelection SelectColumn(int column_index);

Select a column of the table.

Parameters:

  • index: The index of the column to select.

Note

You can use negative index to select from the end.

Examples: dom/table

SelectColumns ​

cpp
TableSelection SelectColumns(int column_min, int column_max);

Select a range of columns of the table.

Parameters:

  • column_min: The first column to select.
  • column_max: The last column to select.

Note

You can use negative index to select from the end.

SelectRectangle ​

cpp
TableSelection SelectRectangle(int column_min, int column_max, int row_min, int row_max);

Select a rectangle of the table.

Parameters:

  • column_min: The first column to select.
  • column_max: The last column to select.
  • row_min: The first row to select.
  • row_max: The last row to select.

Note

You can use negative index to select from the end.

SelectRow ​

cpp
TableSelection SelectRow(int row_index);

Select a row of the table.

Parameters:

  • index: The index of the row to select.

Note

You can use negative index to select from the end.

Examples: dom/table

SelectRows ​

cpp
TableSelection SelectRows(int row_min, int row_max);

Select a range of rows of the table.

Parameters:

  • row_min: The first row to select.
  • row_max: The last row to select.

Note

You can use negative index to select from the end.

Examples: dom/table

Table ​

cpp
Table();

Create an empty table.

Examples: dom/table

Table ​

cpp
Table(std::vector< std::vector< std::string > >);

Create a table from a vector of vector of string.

Parameters:

  • input: The input data.

Examples: dom/table

Table ​

cpp
Table(std::vector< std::vector< Element > >);

Create a table from a vector of vector of Element.

Parameters:

  • input: The input elements.

Examples: dom/table

Border ​

cpp
void Border(BorderStyle border = LIGHT);

Apply a border around the selection.

Parameters:

  • border: The border style to apply.

Examples: dom/table

BorderBottom ​

cpp
void BorderBottom(BorderStyle border = LIGHT);

Draw some separator lines to the bottom side of the selection.

Parameters:

  • border: The border style to apply.

BorderLeft ​

cpp
void BorderLeft(BorderStyle border = LIGHT);

Draw some separator lines to the left side of the selection.

Parameters:

  • border: The border style to apply.

BorderRight ​

cpp
void BorderRight(BorderStyle border = LIGHT);

Draw some separator lines to the right side of the selection.

Parameters:

  • border: The border style to apply.

BorderTop ​

cpp
void BorderTop(BorderStyle border = LIGHT);

Draw some separator lines to the top side of the selection.

Parameters:

  • border: The border style to apply.

Decorate ​

Apply the decorator to the selection. This decorate both the cells, the lines and the corners.

Parameters:

  • decorator: The decorator to apply.

Examples: dom/table

DecorateAlternateColumn ​

cpp
void DecorateAlternateColumn(Decorator, int modulo = 2, int shift = 0);

Apply the decorator to the selection. This decorate only the lines modulo modulo with a shift of shift.

Parameters:

  • decorator: The decorator to apply.
  • modulo: The modulo of the lines to decorate.
  • shift: The shift of the lines to decorate.

DecorateAlternateRow ​

cpp
void DecorateAlternateRow(Decorator, int modulo = 2, int shift = 0);

Apply the decorator to the selection. This decorate only the lines modulo modulo with a shift of shift.

Parameters:

  • decorator: The decorator to apply.
  • modulo: The modulo of the lines to decorate.
  • shift: The shift of the lines to decorate.

DecorateCells ​

Apply the decorator to the selection.

Parameters:

  • decorator: The decorator to apply. This decorate only the cells.

Examples: dom/table

DecorateCellsAlternateColumn ​

cpp
void DecorateCellsAlternateColumn(Decorator, int modulo = 2, int shift = 0);

Apply the decorator to the selection. This decorate only the corners modulo modulo with a shift of shift.

Parameters:

  • decorator: The decorator to apply.
  • modulo: The modulo of the corners to decorate.
  • shift: The shift of the corners to decorate.

DecorateCellsAlternateRow ​

cpp
void DecorateCellsAlternateRow(Decorator, int modulo = 2, int shift = 0);

Apply the decorator to the selection. This decorate only the corners modulo modulo with a shift of shift.

Parameters:

  • decorator: The decorator to apply.
  • modulo: The modulo of the corners to decorate.
  • shift: The shift of the corners to decorate.

Examples: dom/table

Separator ​

cpp
void Separator(BorderStyle border = LIGHT);

Draw some separator lines in the selection.

Parameters:

  • border: The border style to apply.

SeparatorHorizontal ​

cpp
void SeparatorHorizontal(BorderStyle border = LIGHT);

Draw some horizontal separator lines in the selection.

Parameters:

  • border: The border style to apply.

SeparatorVertical ​

cpp
void SeparatorVertical(BorderStyle border = LIGHT);

Draw some vertical separator lines in the selection.

Parameters:

  • border: The border style to apply.

Examples: dom/table

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/button_animated, component/button_in_frame, component/button_style, component/collapsible, component/composition, component/custom_loop, component/dropdown_custom, component/flexbox_gallery, component/focus, component/focus_cursor, component/gallery (+55 more)

underlined ​

Make the underlined element to be underlined.

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

underlinedDouble ​

Apply a underlinedDouble to text.

Examples: dom/style_gallery, dom/style_underlined_double

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_animated, component/button_in_frame, component/composition, component/custom_loop, component/dropdown_custom, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input, component/input_style, component/linear_gradient_gallery (+34 more)

vcenter ​

Center an element vertically.

Parameters:

  • child: The decorated element.

Returns: The centered element.

vscroll_indicator ​

Display a vertical scrollbar to the right. colors.

Examples: component/button_in_frame, component/checkbox_in_frame, component/dropdown_custom, component/homescreen, component/input_in_frame, component/menu_in_frame, component/radiobox_in_frame, component/selection

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
!

Examples: dom/gauge_direction

window ​

cpp
Element window(Element title, Element content, BorderStyle border = ROUNDED);

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

Parameters:

  • title: The title of the window.
  • content: The element to be wrapped.
  • border: The style of the border. Default is ROUNDED.

See also: border

Example

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

// With specifying border
Element document = window(text("Title"),
                          text("content"),
                          ROUNDED
                   );

Output

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

Examples: component/flexbox_gallery, component/homescreen, component/menu_multiple, component/selection, 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.

xframe ​

cpp
Element xframe(Element);

Same as frame, but only on the x-axis.

See also: frame, xframe, yframe

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.

yframe ​

cpp
Element yframe(Element);

Same as frame, but only on the y-axis.

See also: frame, xframe, yframe

Examples: component/homescreen