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

ftxui::Table ​

cpp
#include <ftxui/dom/table.hpp>

Table is a utility to draw tables.

example

cpp
auto table = Table({
 {"X", "Y"},
 {"-1", "1"},
 {"+0", "0"},
 {"+1", "1"},
});

table.SelectAll().Border(LIGHT);
table.SelectRow(1).Border(DOUBLE);
table.SelectRow(1).SeparatorInternal(LIGHT);

std::move(table).Render();

Examples: dom/table

Summary ​

SymbolDescription
TableCreate an empty table.
SelectAllSelect all the table.
SelectCellSelect a cell of the table.
SelectRowSelect a row of the table.
SelectRowsSelect a range of rows of the table.
SelectColumnSelect a column of the table.
SelectColumnsSelect a range of columns of the table.
SelectRectangleSelect a rectangle of the table.
RenderRender the table.

Public Member Functions ​

Table ​

cpp
Table();

Create an empty table.

Examples: dom/table

Table ​

cpp
Table(const 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

Table ​

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

Create a table from a list of list of string.

Parameters:

  • init: The input data.

Examples: dom/table

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.

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.

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.

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.

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.

Render ​

Render the table.

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

Examples: component/button, 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 (+61 more)