FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
ftxui / dom

title-img

This module defines a hierarchical set of ftxui::Element. An element manages the layout and can be responsive to the terminal dimension changes. Note the following example where this module is used to create a simple layout with a number of operators:

The Example section provides a collection of examples.

Example:

namespace ftxui {
...
// Define the document
Element document = vbox({
text("The window") | bold | color(Color::Blue),
gauge(0.5)
text("The footer")
});
// Add a border, by calling the `ftxui::border` decorator function.
document = border(document);
// Add another border, using the pipe operator.
document = document | border.
// Add another border, using the |= operator.
document |= border
...
}
Element text(std::string_view text)
Display a piece of UTF8 encoded unicode text.
Element color(Color color, Element child)
Set the foreground color of an element.
Definition dom/color.cpp:81
Element gauge(float progress)
Draw a high definition progress bar.
Element vbox(Elements children)
A container displaying elements vertically one by one.
Definition vbox.cpp:96
The FTXUI ftxui:: namespace.
Definition animation.hpp:11

List of elements

The list of all elements are included and can be accessed by including the corresponding header file:

// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_DOM_ELEMENTS_HPP
#define FTXUI_DOM_ELEMENTS_HPP
#include <functional>
#include <memory>
#include <string_view>
namespace ftxui {
class Node;
using Element = std::shared_ptr<Node>;
using Elements = std::vector<Element>;
using Decorator = std::function<Element(Element)>;
using GraphFunction = std::function<std::vector<int>(int, int)>;
/// @brief BorderStyle is an enumeration that represents the different styles
/// of borders that can be applied to elements in the terminal UI.
///
/// BorderStyle is an enumeration that represents the different styles of
/// borders that can be applied to elements in the terminal UI.
/// It is used to define the visual appearance of borders around elements,
/// such as windows, frames, or separators.
/// @ingroup dom
};
// Pipe elements into decorator together.
// For instance the next lines are equivalents:
// -> text("ftxui") | bold | underlined
// -> underlined(bold(text("FTXUI")))
// --- Widget ---
FTXUI_EXPORT(DOM) Element text(std::string_view text);
FTXUI_EXPORT(DOM) Element vtext(std::string_view text);
FTXUI_EXPORT(DOM) Element separatorCharacter(std::string_view);
float right,
Color unselected_color,
Color selected_color);
float down,
Color unselected_color,
Color selected_color);
FTXUI_EXPORT(DOM) Element gauge(float progress);
FTXUI_EXPORT(DOM) Element gaugeLeft(float progress);
FTXUI_EXPORT(DOM) Element gaugeRight(float progress);
FTXUI_EXPORT(DOM) Element gaugeUp(float progress);
FTXUI_EXPORT(DOM) Element gaugeDown(float progress);
FTXUI_EXPORT(DOM) Decorator borderWith(const Cell&);
Element window(Element title, Element content, BorderStyle border = ROUNDED);
FTXUI_EXPORT(DOM) Element spinner(int charset_index, size_t image_index);
FTXUI_EXPORT(DOM) Element paragraph(std::string_view text);
FTXUI_EXPORT(DOM) Element paragraphAlignLeft(std::string_view text);
FTXUI_EXPORT(DOM) Element paragraphAlignRight(std::string_view text);
FTXUI_EXPORT(DOM) Element paragraphAlignCenter(std::string_view text);
FTXUI_EXPORT(DOM) Element paragraphAlignJustify(std::string_view text);
FTXUI_EXPORT(DOM) Element canvas(ConstRef<Canvas>);
Element canvas(int width, int height, std::function<void(Canvas&)>);
FTXUI_EXPORT(DOM) Element canvas(std::function<void(Canvas&)>);
// -- Decorator ---
FTXUI_EXPORT(DOM) Decorator color(const LinearGradient&);
FTXUI_EXPORT(DOM) Decorator bgcolor(const LinearGradient&);
FTXUI_EXPORT(DOM) Element color(const LinearGradient&, Element);
FTXUI_EXPORT(DOM) Element bgcolor(const LinearGradient&, Element);
FTXUI_EXPORT(DOM) Decorator hyperlink(std::string_view link);
FTXUI_EXPORT(DOM) Element hyperlink(std::string_view link, Element child);
FTXUI_EXPORT(DOM) Decorator selectionColor(Color foreground);
FTXUI_EXPORT(DOM) Decorator selectionStyle(std::function<void(Cell&)> style);
// --- Layout is
// Horizontal, Vertical or stacked set of elements.
Element flexbox(Elements, FlexboxConfig config = FlexboxConfig());
FTXUI_EXPORT(DOM) Element gridbox(std::vector<Elements> lines);
Element hflow(Elements); // Helper: default flexbox with row direction.
Element vflow(Elements); // Helper: default flexbox with column direction.
// -- Flexibility ---
// Define how to share the remaining space when not all of it is used inside a
// container.
FTXUI_EXPORT(DOM) Element flex(Element); // Expand/Minimize if possible/needed.
FTXUI_EXPORT(DOM) Element flex_grow(Element); // Expand element if possible.
FTXUI_EXPORT(DOM) Element flex_shrink(Element); // Minimize element if needed.
Element xflex(Element); // Expand/Minimize if possible/needed on X axis.
Element xflex_grow(Element); // Expand element if possible on X axis.
Element xflex_shrink(Element); // Minimize element if needed on X axis.
Element yflex(Element); // Expand/Minimize if possible/needed on Y axis.
Element yflex_grow(Element); // Expand element if possible on Y axis.
Element yflex_shrink(Element); // Minimize element if needed on Y axis.
FTXUI_EXPORT(DOM) Element notflex(Element); // Reset the flex attribute.
FTXUI_EXPORT(DOM) Element filler(); // A blank expandable element.
// -- Size override;
// --- Frame ---
// A frame is a scrollable area. The internal area is potentially larger than
// the external one. The internal area is scrolled in order to make visible the
// focused element.
FTXUI_EXPORT(DOM) Element select(Element e); // Deprecated - Alias for focus.
// --- Cursor ---
// Those are similar to `focus`, but also change the shape of the cursor.
// --- Misc ---
// Before drawing the |element| clear the pixel below. This is useful in
// combination with dbox.
// --- Util --------------------------------------------------------------------
namespace Dimension {
FTXUI_EXPORT(DOM) Dimensions Fit(Element&, bool extend_beyond_screen = false);
} // namespace Dimension
} // namespace ftxui
// Make container able to take any number of children as input.
#include "ftxui/dom/take_any_args.hpp"
// Include old definitions using wstring.
#endif // FTXUI_DOM_ELEMENTS_HPP
#define FTXUI_EXPORT(component)
Definition export.hpp:24
Element window(Element title, Element content, BorderStyle border=ROUNDED)
Draw window with a title and a border around the element.
Element borderDouble(Element child)
Draw a double border around the element.
Element focusCursorBarBlinking(Element child)
Same as focus, but set the cursor shape to be a blinking bar.
Definition frame.cpp:189
Element xflex(Element)
Expand/Minimize if possible/needed on the X axis.
Definition flex.cpp:129
Element gaugeDirection(float progress, Direction direction)
Draw a high definition progress bar progressing in specified direction.
Decorator focusPositionRelative(float x, float y)
Used inside a frame, this force the view to be scrolled toward a a given position....
Element separatorStyled(BorderStyle style)
Draw a vertical or horizontal separation in between two other elements.
Element xflex_grow(Element)
Expand if possible on the X axis.
Definition flex.cpp:147
Element underlinedDouble(Element child)
Apply a underlinedDouble to text.
Element clear_under(Element element)
Before drawing |child|, clear the cells below. This is useful in combination with dbox.
Element borderDashed(Element child)
Draw a dashed border around the element.
Element separatorEmpty()
Draw a vertical or horizontal separation in between two other elements, using the EMPTY style.
Element vscroll_indicator(Element child)
Display a vertical scrollbar on the right. Colors follow the content.
Element nothing(Element element)
A decoration doing absolutely nothing.
Definition dom/util.cpp:28
Element paragraphAlignLeft(std::string_view the_text)
Return an element drawing the paragraph on multiple lines, aligned on the left.
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
Apply a constraint on the size of an element.
Direction
Direction is an enumeration that represents the four cardinal directions.
Definition direction.hpp:13
Element flex(Element child)
Make a child element to expand proportionally to the space left in a container.
Definition flex.cpp:123
Element hyperlink(std::string_view link, Element child)
Make the rendered area clickable using a web browser. The link will be opened when the user clicks on...
Definition hyperlink.cpp:52
Element gaugeRight(float progress)
Draw a high definition progress bar progressing from left to right.
Element focusCursorUnderlineBlinking(Element child)
Same as focus, but set the cursor shape to be a blinking underline.
Definition frame.cpp:217
Element bold(Element child)
Use a bold font, for elements with more emphasis.
Definition bold.cpp:33
Element separatorLight()
Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.
Element spinner(int charset_index, size_t image_index)
Useful to represent the effect of time and/or events. This displays an ASCII art "video".
Element borderRounded(Element child)
Draw a rounded border around the element.
Element emptyElement()
Definition dom/util.cpp:140
Element yflex(Element)
Expand/Minimize if possible/needed on the Y axis.
Definition flex.cpp:135
Element flex_shrink(Element child)
Minimize if needed.
Definition flex.cpp:159
Element focusCursorBar(Element child)
Same as focus, but set the cursor shape to be a still block.
Definition frame.cpp:175
Element focusCursorBlock(Element child)
Same as focus, but set the cursor shape to be a still block.
Definition frame.cpp:147
Element vtext(std::string_view text)
Display a piece of unicode text vertically.
Element underlined(Element child)
Underline the given element.
Element center(Element child)
Center an element horizontally and vertically.
Element paragraphAlignJustify(std::string_view the_text)
Return an element drawing the paragraph on multiple lines, aligned using a justified alignment....
Element focusCursorUnderline(Element child)
Same as focus, but set the cursor shape to be a still underline.
Definition frame.cpp:203
Element borderHeavy(Element child)
Draw a heavy border around the element.
Element inverted(Element child)
Add a filter that will invert the foreground and the background colors.
Definition inverted.cpp:34
Element gaugeUp(float progress)
Draw a high definition progress bar progressing from bottom to top.
Element align_right(Element child)
Align an element on the right side.
Decorator focusPosition(int x, int y)
Used inside a frame, this force the view to be scrolled toward a a given position....
Element yflex_grow(Element)
Expand if possible on the Y axis.
Definition flex.cpp:153
Element hscroll_indicator(Element child)
Display a horizontal scrollbar at the bottom. Colors follow the content.
Element flex_grow(Element child)
Expand if possible.
Definition flex.cpp:141
Element separatorDashed()
Draw a vertical or horizontal separation in between two other elements, using the DASHED style.
Element notflex(Element child)
Make the element not flexible.
Definition flex.cpp:177
Element strikethrough(Element child)
Apply a strikethrough to text.
Element italic(Element child)
Apply a underlinedDouble to text.
Definition italic.cpp:17
Element dbox(Elements children_)
Stack several element on top of each other.
Element xflex_shrink(Element)
Minimize if needed on the X axis.
Definition flex.cpp:165
Decorator borderWith(const Cell &pixel)
Same as border but with a constant Cell around the element.
Element gaugeLeft(float progress)
Draw a high definition progress bar progressing from right to left.
Element paragraphAlignCenter(std::string_view the_text)
Return an element drawing the paragraph on multiple lines, aligned on the center.
Element borderLight(Element child)
Draw a light border around the element.
Element focus(Element child)
Set the child to be the one focused among its siblings.
Definition frame.cpp:101
Element paragraph(std::string_view the_text)
Return an element drawing the paragraph on multiple lines.
Element bgcolor(Color color, Element child)
Set the background color of an element.
Definition dom/color.cpp:96
Decorator borderStyled(BorderStyle style)
Same as border but with different styles.
Element paragraphAlignRight(std::string_view the_text)
Return an element drawing the paragraph on multiple lines, aligned on the right.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element filler()
An element that will take expand proportionally to the space left in a container.
Definition flex.cpp:98
Element dim(Element child)
Use a light font, for elements with less emphasis.
Definition dim.cpp:33
Element automerge(Element child)
Enable character to be automatically merged with others nearby.
Definition automerge.cpp:17
Element separatorCharacter(std::string_view value)
Draw a vertical or horizontal separation in between two other elements.
Element blink(Element child)
The text drawn alternates in between visible and hidden.
Definition blink.cpp:33
Element vcenter(Element child)
Center an element vertically.
Element separatorDouble()
Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
Element focusCursorBlockBlinking(Element child)
Same as focus, but set the cursor shape to be a blinking block.
Definition frame.cpp:161
Element border(Element child)
Draw a border around the element.
Element separatorHeavy()
Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.
Element borderEmpty(Element child)
Draw an empty border around the element.
Element yflex_shrink(Element)
Minimize if needed on the Y axis.
Definition flex.cpp:171
Element hcenter(Element child)
Center an element horizontally.
BorderStyle
BorderStyle is an enumeration that represents the different styles of borders that can be applied to ...
Definition elements.hpp:37
Element gaugeDown(float progress)
Draw a high definition progress bar progressing from top to bottom.
@ EMPTY
Definition elements.hpp:43
@ DOUBLE
Definition elements.hpp:41
@ HEAVY
Definition elements.hpp:40
@ ROUNDED
Definition elements.hpp:42
@ DASHED
Definition elements.hpp:39
@ LIGHT
Definition elements.hpp:38
The FTXUI ftxui::Dimension:: namespace.
bool extend_beyond_screen
Definition elements.hpp:215
WidthOrHeight
Definition elements.hpp:176
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
A container displaying elements on row/columns and capable of wrapping on the next column/row when fu...
Definition flexbox.cpp:252
Element separatorVSelector(float up, float down, Color unselected_color, Color selected_color)
Draw an vertical bar, with the area in between up/downcolored differently.
size_t image_index
Definition elements.hpp:96
std::shared_ptr< Node > Element
Definition elements.hpp:24
Element xframe(Element child)
Same as frame, but only on the x-axis.
Definition frame.cpp:126
FTXUI_EXPORT(DOM) Element gridbox(std Element hflow(Elements)
A container displaying elements in rows from left to right. When filled, it starts on a new row below...
Definition flexbox.cpp:270
FTXUI_EXPORT(DOM) Element separatorCharacter(std Element separatorHSelector(float left, float right, Color unselected_color, Color selected_color)
Draw a horizontal bar, with the area in between left/right colored differently.
Direction direction
Definition elements.hpp:82
Element hbox(Elements children)
A container displaying elements horizontally one by one.
Definition hbox.cpp:94
std::vector< Element > Elements
Definition elements.hpp:25
Decorator selectionForegroundColor(Color foreground)
Set the foreground color of an element when selected. Note that the style is applied on top of the ex...
Component operator|(Component component, ComponentDecorator decorator)
Decorator selectionBackgroundColor(Color foreground)
Set the background color of an element when selected. Note that the style is applied on top of the ex...
std::function< Element(Element)> Decorator
Definition elements.hpp:26
Element yframe(Element child)
Same as frame, but only on the y-axis.
Definition frame.cpp:134
Decorator selectionColor(Color foreground)
Set the color of an element when selected.
int y
Definition elements.hpp:126
Element selectionStyleReset(Element child)
Reset the selection style of an element.
const Element & element
Definition node.hpp:95
Decorator reflect(Box &box)
Definition reflect.cpp:43
std::function< std::vector< int >(int, int)> GraphFunction
Definition elements.hpp:27
Element gridbox(std::vector< Elements > lines)
A container displaying a grid of elements.
int value
Definition elements.hpp:178
Element canvas(int width, int height, std::function< void(Canvas &)>)
Produce an element drawing a canvas of requested size.
Element frame(Element child)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
Definition frame.cpp:118
Component & operator|=(Component &component, ComponentDecorator decorator)
Element select(Element e)
Set the child to be the one focused among its siblings.
Definition frame.cpp:108
Decorator selectionStyle(std::function< void(Cell &)> style)
Set the style of an element when selected.
@ LESS_THAN
Definition elements.hpp:177
@ GREATER_THAN
Definition elements.hpp:177
Element vflow(Elements)
A container displaying elements in rows from top to bottom. When filled, it starts on a new columns o...
Definition flexbox.cpp:290
Element graph(GraphFunction graph_function)
Draw a graph using a GraphFunction.
std::uint8_t left
Definition screen.cpp:142
std::uint8_t down
Definition screen.cpp:145
std::uint8_t right
Definition screen.cpp:144

text

The most simple widget. It displays a text.

text("I am a piece of text");
I am a piece of text.

vtext

Identical to ftxui::text, but displayed vertically.

Code:

vtext("HELLO");

Terminal output:

H
E
L
L
O

paragraph 

Similar to ftxui::text, but the individual word are wrapped along multiple lines, depending on the width of its container.

Sample Code:

paragraph("A very long text")

ezgif com-gif-maker (4)

For a more detailed example refer to detailed example. Paragraph also includes a number of other variants as shown below:

namespace ftxui {
Element paragraph(std::string text);
Element paragraphAlignLeft(std::string text);
Element paragraphAlignRight(std::string text);
Element paragraphAlignCenter(std::string text);
Element paragraphAlignJustify(std::string text);
}

border

Adds a border around an element.

Code:

border(text("The element"))

Terminal output:

┌───────────┐
│The element│
└───────────┘
Note
You can achieve the same behavior by using the pipe operator.

Code:
text("The element") | border

Border also comes in a variety of styles as shown below:

window

A ftxui::window is a ftxui::border, but with an additional header. To add a window around an element, wrap it and specify a string as the header. Code:

window("The window", text("The element"))

Terminal output:

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

separator

Displays a vertical/horizontal line to visually split the content of a container in two.

Code:

border(
hbox({
text("Left"),
separator(),
text("Right")
})
)

Terminal output:

┌────┬─────┐
│left│right│
└────┴─────┘

Separators come in a variety of flavors as shown below:

namespace ftxui {
float right,
Color background,
Color foreground);
float down,
Color background,
Color foreground);
}

gauge

This is a visual element that represents a ratio of progress.

Code:

border(gauge(0.5))

Terminal output:

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

Gauges can be displayed in many orientations as shown below:

namespace {
Element gauge(float ratio);
Element gaugeLeft(float ratio);
Element gaugeRight(float ratio);
Element gaugeUp(float ratio);
Element gaugeDown(float ratio);
Element gaugeDirection(float ratio, GaugeDirection);
}

graph

See:

Element graph(GraphFunction);

Colors

Most terminal consoles can display colored text and colored backgrounds. FTXUI supports every color palette:

Decorator color(Color);
Decorator bgcolor(Color);

Color gallery: image

Palette16 

On most terminals the following colors are supported:

  • Default
  • Black
  • GrayDark
  • GrayLight
  • White
  • Blue
  • BlueLight
  • Cyan
  • CyanLight
  • Green
  • GreenLight
  • Magenta
  • MagentaLight
  • Red
  • RedLight
  • Yellow
  • YellowLight

Example use of the above colors using the pipe operator:

text("Blue foreground") | color(Color::Blue);
text("Blue background") | bgcolor(Color::Blue);
text("Black on white") | color(Color::Black) | bgcolor(Color::White);

Palette256 

On terminal supporting 256 colors.

text("HotPink") | color(Color::HotPink);

TrueColor

On terminal supporting trueColor, you can directly use the 24bit RGB color space:

Use the constructors below to specify the RGB or HSV values for your color:

There are two constructors:

ftxui::Color::RGB(uint8_t red, uint8_t green, uint8_t blue);
ftxui::Color::HSV(uint8_t hue, uint8_t saturation, uint8_t value);

LinearGradient

FTXUI supports linear gradient. Either on the foreground or the background.

Decorator color(const LinearGradient&);
Decorator bgcolor(const LinearGradient&);

A ftxui::LinearGradient is defined by an angle in degree, and a list of color stops.

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

You can also use simplified constructors:

LinearGradient(Color::Red, Color::Blue);
LinearGradient(45, Color::Red, Color::Blue);

See demo.

Style

In addition to colored text and colored backgrounds. Many terminals support text effects such as: bold, italic, dim, underlined, inverted, blink.

Element bold(Element);
Element italic(Element);
Element dim(Element);
Element inverted(Element);
Element underlined(Element);
Element underlinedDouble(Element);
Element strikethrough(Element);
Element blink(Element);
Decorator color(Color);
Decorator bgcolor(Color);
Decorator colorgrad(LinearGradient);
Decorator bgcolorgrad(LinearGradient);

Example

image

To use these effects, simply wrap your elements with your desired effect:

underlined(bold(text("This text is bold and underlined")))

Alternatively, use the pipe operator to chain it on your element:

text("This text is bold") | bold | underlined

Layout

Enables elements to be arranged in the following ways:

  • Horizontally with ftxui::hbox
  • Vertically with ftxui::vbox
  • Inside a grid with ftxui::gridbox
  • Wrapped along one direction using the ftxui::flexbox.

Example using ftxui::hbox, ftxui::vbox and ftxui::filler.

image

Example using ftxui::gridbox:

image

Example using flexbox:

image

Checkout this example and the associated demo.

Element can also become flexible using the ftxui::flex decorator.

Code:

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

Terminal output:

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

Code:

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

Terminal output:

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

Table

Enables easy formatting of data into a neat table like visual form.

Basic example:

auto table = Table({
{"Planet", "Radius", "Mass"},
{"Mercury", "2440", "0.330"},
{"Venus", "6052", "4.87"},
{"Earth", "6371", "5.97"},
{"Mars", "3390", "0.642"},
});
table.SelectAll().Border(LIGHT);
table.SelectRow(0).Decorate(bold);
table.SelectRow(0).SeparatorVertical(LIGHT);
table.SelectRow(0).Border(DOUBLE);
auto document = table.Render();

Code example:

image

Selection and Styling

You can select parts of the table and apply decorators or borders to them. Selection methods include:

ftxui::TableSelection::SelectAll();
ftxui::TableSelection::SelectCell(column, row);
ftxui::TableSelection::SelectRow(row_index);
ftxui::TableSelection::SelectRows(row_min, row_max);
ftxui::TableSelection::SelectColumn(column_index);
ftxui::TableSelection::SelectColumns(column_min, column_max);
ftxui::TableSelection::SelectRectangle(column_min, column_max, row_min, row_max);

Once a selection is made, you can apply:

ftxui::TableSelection::Decorate(Decorator); // Apply a decorator to the whole selection (cells and borders).
ftxui::TableSelection::DecorateCells(Decorator); // Apply a decorator only to the cells.
ftxui::TableSelection::Border(BorderStyle); // Add a border around the selection.
ftxui::TableSelection::Separator(BorderStyle); //

Colored borders

You can also apply decorators specifically to borders and separators:

// Apply a red border to the whole table.
table.SelectAll().Border(LIGHT, color(Color::Red));
// Apply a blue separator to the first row.
table.SelectRow(0).SeparatorVertical(LIGHT, color(Color::Blue));

The following methods are available for fine-grained border decoration:

ftxui::TableSelection::DecorateBorder(Decorator); // Apply a decorator to all borders of the selection.
ftxui::TableSelection::DecorateBorderLeft(Decorator); // Apply a decorator to the left border of the selection.
ftxui::TableSelection::DecorateBorderRight(Decorator); // Apply a decorator to the right border of the selection.
ftxui::TableSelection::DecorateBorderTop(Decorator); // Apply a decorator to the top border of the selection.
ftxui::TableSelection::DecorateBorderBottom(Decorator); // Apply a decorator to the bottom border of the selection.
ftxui::TableSelection::DecorateSeparator(Decorator); // Apply a decorator to all separators of the selection.
ftxui::TableSelection::DecorateSeparatorVertical(Decorator); // Apply a decorator to all vertical separators of the selection.
ftxui::TableSelection::DecorateSeparatorHorizontal(Decorator); // Apply a decorator to all horizontal separators of the selection.

Canvas

See the API <ftxui/dom/canvas.hpp>

auto c = Canvas(100, 100);
c.DrawPointLine(10, 10, 80, 10, Color::Red);
auto element = canvas(c);

Drawing can be performed on a ftxui::Canvas, using braille, block, or simple characters:

Simple example:

image

Complex example:

ezgif com-gif-maker (3)