# FTXUI: ftxui/dom

Loading...
Searching...
No Matches
ftxui/dom

## Detailed Description

Please check the tutorial of the `ftxui/dom` module.

## Classes

struct | Canvas
| Canvas is a drawable buffer associated with drawing operations. More...
struct | FlexboxConfig
| FlexboxConfig is a configuration structure that defines the layout properties for a flexbox container. More...
struct | LinearGradient
| A class representing the settings for linear-gradient color effect. More...
class | Node
| Node is the base class for all elements in the DOM tree. More...
struct | Requirement
| Requirement is a structure that defines the layout requirements for a Node in the terminal user interface. More...
class | Selection
| Represents a selection in a terminal user interface. More...
class | Table
| Table is a utility to draw tables. More...

## Enumerations

enum class | Direction { Up = 0 , Down = 1 , Left = 2 , Right = 3 }
| Direction is an enumeration that represents the four cardinal directions. More...
enum | BorderStyle { LIGHT , DASHED , HEAVY , DOUBLE , ROUNDED , EMPTY }
| BorderStyle is an enumeration that represents the different styles of borders that can be applied to elements in the terminal UI. More...

## Functions

Element | automerge (Element child)
| Enable character to be automatically merged with others nearby.
Element | blink (Element child)
| The text drawn alternates in between visible and hidden.
Element | bold (Element child)
| Use a bold font, for elements with more emphasis.
Element | border (Element child)
| Draw a border around the element.
Decorator | borderWith (const Pixel &pixel)
| Same as border but with a constant Pixel around the element.
Decorator | borderStyled (BorderStyle style)
| Same as border but with different styles.
Decorator | borderStyled (Color foreground_color)
| Same as border but with a foreground color.
Decorator | borderStyled (BorderStyle style, Color foreground_color)
| Same as border but with a foreground color and a different style.
Element | borderDashed (Element child)
| Draw a dashed border around the element.
Element | borderLight (Element child)
| Draw a light border around the element.
Element | borderHeavy (Element child)
| Draw a heavy border around the element.
Element | borderDouble (Element child)
| Draw a double border around the element.
Element | borderRounded (Element child)
| Draw a rounded border around the element.
Element | borderEmpty (Element child)
| Draw an empty border around the element.
Element | window (Element title, Element content, BorderStyle border)
| Draw window with a title and a border around the element.
Element | clear_under (Element element)
| Before drawing |child|, clear the pixels below. This is useful in combination with dbox.
Element | color (Color color, Element child)
| Set the foreground color of an element.
Element | bgcolor (Color color, Element child)
| Set the background color of an element.
Decorator | color (Color c)
| Decorate using a foreground color.
Decorator | bgcolor (Color color)
| Decorate using a background color.
Element | hcenter (Element child)
| Center an element horizontally.
Element | vcenter (Element child)
| Center an element vertically.
Element | center (Element child)
| Center an element horizontally and vertically.
Element | align_right (Element child)
| Align an element on the right side.
Element | dbox (Elements children_)
| Stack several element on top of each other.
Element | dim (Element child)
| Use a light font, for elements with less emphasis.
Element | filler ()
| An element that will take expand proportionally to the space left in a container.
Element | flex (Element child)
| Make a child element to expand proportionally to the space left in a container.
Element | xflex (Element child)
| Expand/Minimize if possible/needed on the X axis.
Element | yflex (Element child)
| Expand/Minimize if possible/needed on the Y axis.
Element | flex_grow (Element child)
| Expand if possible.
Element | xflex_grow (Element child)
| Expand if possible on the X axis.
Element | yflex_grow (Element child)
| Expand if possible on the Y axis.
Element | flex_shrink (Element child)
| Minimize if needed.
Element | xflex_shrink (Element child)
| Minimize if needed on the X axis.
Element | yflex_shrink (Element child)
| Minimize if needed on the Y axis.
Element | notflex (Element child)
| Make the element not flexible.
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.
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.
Element | focus (Element child)
| Set the `child` to be the one focused among its siblings.
Element | focusCursorBlock (Element child)
| Same as `focus`, but set the cursor shape to be a still block.
Element | focusCursorBlockBlinking (Element child)
| Same as `focus`, but set the cursor shape to be a blinking block.
Element | focusCursorBar (Element child)
| Same as `focus`, but set the cursor shape to be a still block.
Element | focusCursorBarBlinking (Element child)
| Same as `focus`, but set the cursor shape to be a blinking bar.
Element | focusCursorUnderline (Element child)
| Same as `focus`, but set the cursor shape to be a still underline.
Element | focusCursorUnderlineBlinking (Element child)
| Same as `focus`, but set the cursor shape to be a blinking underline.
Element | gaugeDirection (float progress, Direction direction)
| Draw a high definition progress bar progressing in specified direction.
Element | gaugeRight (float progress)
| Draw a high definition progress bar progressing from left to right.
Element | gaugeLeft (float progress)
| Draw a high definition progress bar progressing from right to left.
Element | gaugeUp (float progress)
| Draw a high definition progress bar progressing from bottom to top.
Element | gaugeDown (float progress)
| Draw a high definition progress bar progressing from top to bottom.
Element | gauge (float progress)
| Draw a high definition progress bar.
Element | hyperlink (std::string link, Element child)
| Make the rendered area clickable using a web browser. The link will be opened when the user clicks on it. This is supported only on a limited set of terminal emulators. List: https://github.com/Alhadis/OSC8-Adoption/.
Decorator | hyperlink (std::string link)
| Decorate using a hyperlink. The link will be opened when the user clicks on it. This is supported only on a limited set of terminal emulators. List: https://github.com/Alhadis/OSC8-Adoption/.
Element | inverted (Element child)
| Add a filter that will invert the foreground and the background colors.
Element | italic (Element child)
| Apply a underlinedDouble to text.
Element | color (const LinearGradient &gradient, Element child)
| Set the foreground color of an element with linear-gradient effect.
Element | bgcolor (const LinearGradient &gradient, Element child)
| Set the background color of an element with linear-gradient effect.
Decorator | color (const LinearGradient &gradient)
| Decorate using a linear-gradient effect on the foreground color.
Decorator | bgcolor (const LinearGradient &gradient)
| Decorate using a linear-gradient effect on the background color.
void | Render (Screen &screen, const Element &element)
| Display an element on a ftxui::Screen.
void | Render (Screen &screen, Node *node)
| Display an element on a ftxui::Screen.
Element | paragraph (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines.
Element | paragraphAlignLeft (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned on the left.
Element | paragraphAlignRight (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned on the right.
Element | paragraphAlignCenter (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned on the center.
Element | paragraphAlignJustify (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned using a justified alignment. the center.
Element | vscroll_indicator (Element child)
| Display a vertical scrollbar on the right. Colors follow the content.
Element | hscroll_indicator (Element child)
| Display a horizontal scrollbar at the bottom. Colors follow the content.
Element | separator ()
| Draw a vertical or horizontal separation in between two other elements.
Element | separatorStyled (BorderStyle style)
| Draw a vertical or horizontal separation in between two other elements.
Element | separatorLight ()
| Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.
Element | separatorDashed ()
| Draw a vertical or horizontal separation in between two other elements, using the DASHED style.
Element | separatorHeavy ()
| Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.
Element | separatorDouble ()
| Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
Element | separatorEmpty ()
| Draw a vertical or horizontal separation in between two other elements, using the EMPTY style.
Element | separatorCharacter (std::string value)
| Draw a vertical or horizontal separation in between two other elements.
Element | separator (Pixel pixel)
| Draw a separator in between two element filled with a given pixel.
Decorator | size (WidthOrHeight direction, Constraint constraint, int value)
| Apply a constraint on the size of an element.
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 | strikethrough (Element child)
| Apply a strikethrough to text.
Element | text (std::string text)
| Display a piece of UTF8 encoded unicode text.
Element | text (std::wstring text)
| Display a piece of unicode text.
Element | vtext (std::string text)
| Display a piece of unicode text vertically.
Element | vtext (std::wstring text)
| Display a piece unicode text vertically.
Element | underlined (Element child)
| Underline the given element.
Element | underlinedDouble (Element child)
| Apply a underlinedDouble to text.
Element | nothing (Element element)
| A decoration doing absolutely nothing.
Decorator | operator| (Decorator a, Decorator b)
| Compose two decorator into one.
Elements | operator| (Elements elements, Decorator decorator)
| From a set of element, apply a decorator to every elements.
Element | operator| (Element element, Decorator decorator)
| From an element, apply a decorator.
Element & | operator|= (Element &e, Decorator d)
| Apply a decorator to an element.
Element | emptyElement ()
Element | vbox (Elements children)
| A container displaying elements vertically one by one.
void | SetColorSupport (Color color)
| Override terminal color support in case auto-detection fails.

## Class Documentation

## ftxui::Canvas

struct ftxui::Canvas

Canvas is a drawable buffer associated with drawing operations.

Canvas is a drawable area that can be used to create complex graphics. It supports drawing points, lines, circles, ellipses, text, and images using braille, block, or normal characters.

Note: A terminal contains cells. A cells is a unit of:

- 2x4 braille characters (1x1 pixel)
- 2x2 block characters (2x2 pixels)
- 2x4 normal characters (2x4 pixels)

You need to multiply the x coordinate by 2 and the y coordinate by 4 to get the correct position in the terminal.

Examples
  examples/component/canvas_animated.cpp, and examples/dom/canvas.cpp.

Definition at line 38 of file canvas.hpp.

### Public Types

using | Stylizer = std::function<void(Pixel&)>

### Public Member Functions

| Canvas ()=default
| Canvas (int width, int height)
| Constructor.
int | width () const
int | height () const
Pixel | GetPixel (int x, int y) const
| Get the content of a cell.
void | DrawPointOn (int x, int y)
| Draw a braille dot.
void | DrawPointOff (int x, int y)
| Erase a braille dot.
void | DrawPointToggle (int x, int y)
| Toggle a braille dot. A filled one will be erased, and the other will be drawn.
void | DrawPoint (int x, int y, bool value)
| Draw a braille dot.
void | DrawPoint (int x, int y, bool value, const Stylizer &s)
| Draw a braille dot.
void | DrawPoint (int x, int y, bool value, const Color &color)
| Draw a braille dot.
void | DrawPointLine (int x1, int y1, int x2, int y2)
| Draw a line made of braille dots.
void | DrawPointLine (int x1, int y1, int x2, int y2, const Stylizer &s)
| Draw a line made of braille dots.
void | DrawPointLine (int x1, int y1, int x2, int y2, const Color &color)
| Draw a line made of braille dots.
void | DrawPointCircle (int x, int y, int radius)
| Draw a circle made of braille dots.
void | DrawPointCircle (int x, int y, int radius, const Stylizer &s)
| Draw a circle made of braille dots.
void | DrawPointCircle (int x, int y, int radius, const Color &color)
| Draw a circle made of braille dots.
void | DrawPointCircleFilled (int x, int y, int radius)
| Draw a filled circle made of braille dots.
void | DrawPointCircleFilled (int x, int y, int radius, const Stylizer &s)
| Draw a filled circle made of braille dots.
void | DrawPointCircleFilled (int x, int y, int radius, const Color &color)
| Draw a filled circle made of braille dots.
void | DrawPointEllipse (int x, int y, int r1, int r2)
| Draw an ellipse made of braille dots.
void | DrawPointEllipse (int x, int y, int r1, int r2, const Color &color)
| Draw an ellipse made of braille dots.
void | DrawPointEllipse (int x, int y, int r1, int r2, const Stylizer &s)
| Draw an ellipse made of braille dots.
void | DrawPointEllipseFilled (int x, int y, int r1, int r2)
| Draw a filled ellipse made of braille dots.
void | DrawPointEllipseFilled (int x, int y, int r1, int r2, const Color &color)
| Draw a filled ellipse made of braille dots.
void | DrawPointEllipseFilled (int x, int y, int r1, int r2, const Stylizer &s)
| Draw a filled ellipse made of braille dots.
void | DrawBlockOn (int x, int y)
| Draw a block.
void | DrawBlockOff (int x, int y)
| Erase a block.
void | DrawBlockToggle (int x, int y)
| Toggle a block. If it is filled, it will be erased. If it is empty, it will be filled.
void | DrawBlock (int x, int y, bool value)
| Draw a block.
void | DrawBlock (int x, int y, bool value, const Stylizer &s)
| Draw a block.
void | DrawBlock (int x, int y, bool value, const Color &color)
| Draw a block.
void | DrawBlockLine (int x1, int y1, int x2, int y2)
| Draw a line made of block characters.
void | DrawBlockLine (int x1, int y1, int x2, int y2, const Stylizer &s)
| Draw a line made of block characters.
void | DrawBlockLine (int x1, int y1, int x2, int y2, const Color &color)
| Draw a line made of block characters.
void | DrawBlockCircle (int x1, int y1, int radius)
| Draw a circle made of block characters.
void | DrawBlockCircle (int x1, int y1, int radius, const Stylizer &s)
| Draw a circle made of block characters.
void | DrawBlockCircle (int x1, int y1, int radius, const Color &color)
| Draw a circle made of block characters.
void | DrawBlockCircleFilled (int x1, int y1, int radius)
| Draw a filled circle made of block characters.
void | DrawBlockCircleFilled (int x1, int y1, int radius, const Stylizer &s)
| Draw a filled circle made of block characters.
void | DrawBlockCircleFilled (int x1, int y1, int radius, const Color &color)
| Draw a filled circle made of block characters.
void | DrawBlockEllipse (int x1, int y1, int r1, int r2)
| Draw an ellipse made of block characters.
void | DrawBlockEllipse (int x1, int y1, int r1, int r2, const Stylizer &s)
| Draw an ellipse made of block characters.
void | DrawBlockEllipse (int x1, int y1, int r1, int r2, const Color &color)
| Draw an ellipse made of block characters.
void | DrawBlockEllipseFilled (int x1, int y1, int r1, int r2)
| Draw a filled ellipse made of block characters.
void | DrawBlockEllipseFilled (int x1, int y1, int r1, int r2, const Stylizer &s)
| Draw a filled ellipse made of block characters.
void | DrawBlockEllipseFilled (int x1, int y1, int r1, int r2, const Color &color)
| Draw a filled ellipse made of block characters.
void | DrawText (int x, int y, const std::string &value)
| Draw a piece of text.
void | DrawText (int x, int y, const std::string &value, const Color &color)
| Draw a piece of text.
void | DrawText (int x, int y, const std::string &value, const Stylizer &style)
| Draw a piece of text.
void | DrawPixel (int x, int y, const Pixel &)
| Directly draw a predefined pixel at the given coordinate.
void | DrawImage (int x, int y, const Image &)
| Draw a predefined image, with top-left corner at the given coordinate You can supply negative coordinates to align the image however you like - only the 'visible' portion will be drawn.
void | Style (int x, int y, const Stylizer &style)
| Modify a pixel at a given location.

#### Member Typedef Documentation

## Stylizer

using Stylizer = std::function<void(Pixel&)>

Definition at line 48 of file canvas.hpp.

#### Constructor & Destructor Documentation

## Canvas() [1/2]

Canvas | ( |  | ) |

default

## Canvas() [2/2]

Canvas | ( | int | width,
|  | int | height )

Constructor.

Parameters

  width | the width of the canvas. A cell is a 2x4 braille dot.
  height | the height of the canvas. A cell is a 2x4 braille dot.

Definition at line 90 of file src/ftxui/dom/canvas.cpp.

#### Member Function Documentation

## width()

int width | ( |  | ) | const

inline

Definition at line 44 of file canvas.hpp.

## height()

int height | ( |  | ) | const

inline

Definition at line 45 of file canvas.hpp.

## GetPixel()

Pixel GetPixel | ( | int | x,
|  | int | y ) const

Get the content of a cell.

Parameters

  x | the x coordinate of the cell.
  y | the y coordinate of the cell.

Definition at line 98 of file src/ftxui/dom/canvas.cpp.

## DrawPointOn()

void DrawPointOn | ( | int | x,
|  | int | y )

Draw a braille dot.

Parameters

  x | the x coordinate of the dot.
  y | the y coordinate of the dot.

Definition at line 137 of file src/ftxui/dom/canvas.cpp.

## DrawPointOff()

void DrawPointOff | ( | int | x,
|  | int | y )

Erase a braille dot.

Parameters

  x | the x coordinate of the dot.
  y | the y coordinate of the dot.

Definition at line 154 of file src/ftxui/dom/canvas.cpp.

## DrawPointToggle()

void DrawPointToggle | ( | int | x,
|  | int | y )

Toggle a braille dot. A filled one will be erased, and the other will be drawn.

Parameters

  x | the x coordinate of the dot.
  y | the y coordinate of the dot.

Definition at line 172 of file src/ftxui/dom/canvas.cpp.

## DrawPoint() [1/3]

void DrawPoint | ( | int | x,
|  | int | y,
|  | bool | value )

Draw a braille dot.

Parameters

  x | the x coordinate of the dot.
  y | the y coordinate of the dot.
  value | whether the dot is filled or not.

Definition at line 107 of file src/ftxui/dom/canvas.cpp.

## DrawPoint() [2/3]

void DrawPoint | ( | int | x,
|  | int | y,
|  | bool | value,
|  | const Stylizer & | style )

Draw a braille dot.

Parameters

  x | the x coordinate of the dot.
  y | the y coordinate of the dot.
  value | whether the dot is filled or not.
  style | the style of the cell.

Definition at line 125 of file src/ftxui/dom/canvas.cpp.

## DrawPoint() [3/3]

void DrawPoint | ( | int | x,
|  | int | y,
|  | bool | value,
|  | const Color & | color )

Draw a braille dot.

Parameters

  x | the x coordinate of the dot.
  y | the y coordinate of the dot.
  value | whether the dot is filled or not.
  color | the color of the dot.

Definition at line 116 of file src/ftxui/dom/canvas.cpp.

## DrawPointLine() [1/3]

void DrawPointLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2 )

Draw a line made of braille dots.

Parameters

  x1 | the x coordinate of the first dot.
  y1 | the y coordinate of the first dot.
  x2 | the x coordinate of the second dot.
  y2 | the y coordinate of the second dot.

Definition at line 191 of file src/ftxui/dom/canvas.cpp.

## DrawPointLine() [2/3]

void DrawPointLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | const Stylizer & | style )

Draw a line made of braille dots.

Parameters

  x1 | the x coordinate of the first dot.
  y1 | the y coordinate of the first dot.o
  x2 | the x coordinate of the second dot.
  y2 | the y coordinate of the second dot.
  style | the style of the line.

Definition at line 212 of file src/ftxui/dom/canvas.cpp.

## DrawPointLine() [3/3]

void DrawPointLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | const Color & | color )

Draw a line made of braille dots.

Parameters

  x1 | the x coordinate of the first dot.
  y1 | the y coordinate of the first dot.
  x2 | the x coordinate of the second dot.
  y2 | the y coordinate of the second dot.
  color | the color of the line.

Definition at line 201 of file src/ftxui/dom/canvas.cpp.

## DrawPointCircle() [1/3]

void DrawPointCircle | ( | int | x,
|  | int | y,
|  | int | radius )

Draw a circle made of braille dots.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.

Definition at line 249 of file src/ftxui/dom/canvas.cpp.

## DrawPointCircle() [2/3]

void DrawPointCircle | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Stylizer & | style )

Draw a circle made of braille dots.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  style | the style of the circle.

Definition at line 268 of file src/ftxui/dom/canvas.cpp.

## DrawPointCircle() [3/3]

void DrawPointCircle | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Color & | color )

Draw a circle made of braille dots.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  color | the color of the circle.

Definition at line 258 of file src/ftxui/dom/canvas.cpp.

## DrawPointCircleFilled() [1/3]

void DrawPointCircleFilled | ( | int | x,
|  | int | y,
|  | int | radius )

Draw a filled circle made of braille dots.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.

Definition at line 276 of file src/ftxui/dom/canvas.cpp.

## DrawPointCircleFilled() [2/3]

void DrawPointCircleFilled | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Stylizer & | style )

Draw a filled circle made of braille dots.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  style | the style of the circle.

Definition at line 298 of file src/ftxui/dom/canvas.cpp.

## DrawPointCircleFilled() [3/3]

void DrawPointCircleFilled | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Color & | color )

Draw a filled circle made of braille dots.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  color | the color of the circle.

Definition at line 285 of file src/ftxui/dom/canvas.cpp.

## DrawPointEllipse() [1/3]

void DrawPointEllipse | ( | int | x,
|  | int | y,
|  | int | r1,
|  | int | r2 )

Draw an ellipse made of braille dots.

Parameters

  x | the x coordinate of the center of the ellipse.
  y | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.

Definition at line 310 of file src/ftxui/dom/canvas.cpp.

## DrawPointEllipse() [2/3]

void DrawPointEllipse | ( | int | x,
|  | int | y,
|  | int | r1,
|  | int | r2,
|  | const Color & | color )

Draw an ellipse made of braille dots.

Parameters

  x | the x coordinate of the center of the ellipse.
  y | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  color | the color of the ellipse.

Definition at line 320 of file src/ftxui/dom/canvas.cpp.

## DrawPointEllipse() [3/3]

void DrawPointEllipse | ( | int | x1,
|  | int | y1,
|  | int | r1,
|  | int | r2,
|  | const Stylizer & | s )

Draw an ellipse made of braille dots.

Parameters

  x1 | the x coordinate of the center of the ellipse.
  y1 | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  s | the style of the ellipse.

Definition at line 335 of file src/ftxui/dom/canvas.cpp.

## DrawPointEllipseFilled() [1/3]

void DrawPointEllipseFilled | ( | int | x1,
|  | int | y1,
|  | int | r1,
|  | int | r2 )

Draw a filled ellipse made of braille dots.

Parameters

  x1 | the x coordinate of the center of the ellipse.
  y1 | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.

Definition at line 374 of file src/ftxui/dom/canvas.cpp.

## DrawPointEllipseFilled() [2/3]

void DrawPointEllipseFilled | ( | int | x1,
|  | int | y1,
|  | int | r1,
|  | int | r2,
|  | const Color & | color )

Draw a filled ellipse made of braille dots.

Parameters

  x1 | the x coordinate of the center of the ellipse.
  y1 | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  color | the color of the ellipse.

Definition at line 384 of file src/ftxui/dom/canvas.cpp.

## DrawPointEllipseFilled() [3/3]

void DrawPointEllipseFilled | ( | int | x1,
|  | int | y1,
|  | int | r1,
|  | int | r2,
|  | const Stylizer & | s )

Draw a filled ellipse made of braille dots.

Parameters

  x1 | the x coordinate of the center of the ellipse.
  y1 | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  s | the style of the ellipse.

Definition at line 399 of file src/ftxui/dom/canvas.cpp.

## DrawBlockOn()

void DrawBlockOn | ( | int | x,
|  | int | y )

Draw a block.

Parameters

  x | the x coordinate of the block.
  y | the y coordinate of the block.

Definition at line 468 of file src/ftxui/dom/canvas.cpp.

## DrawBlockOff()

void DrawBlockOff | ( | int | x,
|  | int | y )

Erase a block.

Parameters

  x | the x coordinate of the block.
  y | the y coordinate of the block.

Definition at line 488 of file src/ftxui/dom/canvas.cpp.

## DrawBlockToggle()

void DrawBlockToggle | ( | int | x,
|  | int | y )

Toggle a block. If it is filled, it will be erased. If it is empty, it will be filled.

Parameters

  x | the x coordinate of the block.
  y | the y coordinate of the block.

Definition at line 509 of file src/ftxui/dom/canvas.cpp.

## DrawBlock() [1/3]

void DrawBlock | ( | int | x,
|  | int | y,
|  | bool | value )

Draw a block.

Parameters

  x | the x coordinate of the block.
  y | the y coordinate of the block.
  value | whether the block is filled or not.

Definition at line 438 of file src/ftxui/dom/canvas.cpp.

## DrawBlock() [2/3]

void DrawBlock | ( | int | x,
|  | int | y,
|  | bool | value,
|  | const Stylizer & | style )

Draw a block.

Parameters

  x | the x coordinate of the block.
  y | the y coordinate of the block.
  value | whether the block is filled or not.
  style | the style of the block.

Definition at line 456 of file src/ftxui/dom/canvas.cpp.

## DrawBlock() [3/3]

void DrawBlock | ( | int | x,
|  | int | y,
|  | bool | value,
|  | const Color & | color )

Draw a block.

Parameters

  x | the x coordinate of the block.
  y | the y coordinate of the block.
  value | whether the block is filled or not.
  color | the color of the block.

Definition at line 447 of file src/ftxui/dom/canvas.cpp.

## DrawBlockLine() [1/3]

void DrawBlockLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2 )

Draw a line made of block characters.

Parameters

  x1 | the x coordinate of the first point of the line.
  y1 | the y coordinate of the first point of the line.
  x2 | the x coordinate of the second point of the line.
  y2 | the y coordinate of the second point of the line.

Definition at line 531 of file src/ftxui/dom/canvas.cpp.

## DrawBlockLine() [2/3]

void DrawBlockLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | const Stylizer & | style )

Draw a line made of block characters.

Parameters

  x1 | the x coordinate of the first point of the line.
  y1 | the y coordinate of the first point of the line.
  x2 | the x coordinate of the second point of the line.
  y2 | the y coordinate of the second point of the line.
  style | the style of the line.

Definition at line 552 of file src/ftxui/dom/canvas.cpp.

## DrawBlockLine() [3/3]

void DrawBlockLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | const Color & | color )

Draw a line made of block characters.

Parameters

  x1 | the x coordinate of the first point of the line.
  y1 | the y coordinate of the first point of the line.
  x2 | the x coordinate of the second point of the line.
  y2 | the y coordinate of the second point of the line.
  color | the color of the line.

Definition at line 541 of file src/ftxui/dom/canvas.cpp.

## DrawBlockCircle() [1/3]

void DrawBlockCircle | ( | int | x,
|  | int | y,
|  | int | radius )

Draw a circle made of block characters.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.

Definition at line 592 of file src/ftxui/dom/canvas.cpp.

## DrawBlockCircle() [2/3]

void DrawBlockCircle | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Stylizer & | style )

Draw a circle made of block characters.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  style | the style of the circle.

Definition at line 611 of file src/ftxui/dom/canvas.cpp.

## DrawBlockCircle() [3/3]

void DrawBlockCircle | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Color & | color )

Draw a circle made of block characters.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  color | the color of the circle.

Definition at line 601 of file src/ftxui/dom/canvas.cpp.

## DrawBlockCircleFilled() [1/3]

void DrawBlockCircleFilled | ( | int | x,
|  | int | y,
|  | int | radius )

Draw a filled circle made of block characters.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.

Definition at line 619 of file src/ftxui/dom/canvas.cpp.

## DrawBlockCircleFilled() [2/3]

void DrawBlockCircleFilled | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Stylizer & | s )

Draw a filled circle made of block characters.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  s | the style of the circle.

Definition at line 641 of file src/ftxui/dom/canvas.cpp.

## DrawBlockCircleFilled() [3/3]

void DrawBlockCircleFilled | ( | int | x,
|  | int | y,
|  | int | radius,
|  | const Color & | color )

Draw a filled circle made of block characters.

Parameters

  x | the x coordinate of the center of the circle.
  y | the y coordinate of the center of the circle.
  radius | the radius of the circle.
  color | the color of the circle.

Definition at line 628 of file src/ftxui/dom/canvas.cpp.

## DrawBlockEllipse() [1/3]

void DrawBlockEllipse | ( | int | x,
|  | int | y,
|  | int | r1,
|  | int | r2 )

Draw an ellipse made of block characters.

Parameters

  x | the x coordinate of the center of the ellipse.
  y | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.

Definition at line 653 of file src/ftxui/dom/canvas.cpp.

## DrawBlockEllipse() [2/3]

void DrawBlockEllipse | ( | int | x1,
|  | int | y1,
|  | int | r1,
|  | int | r2,
|  | const Stylizer & | s )

Draw an ellipse made of block characters.

Parameters

  x1 | the x coordinate of the center of the ellipse.
  y1 | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  s | the style of the ellipse.

Definition at line 678 of file src/ftxui/dom/canvas.cpp.

## DrawBlockEllipse() [3/3]

void DrawBlockEllipse | ( | int | x,
|  | int | y,
|  | int | r1,
|  | int | r2,
|  | const Color & | color )

Draw an ellipse made of block characters.

Parameters

  x | the x coordinate of the center of the ellipse.
  y | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  color | the color of the ellipse.

Definition at line 663 of file src/ftxui/dom/canvas.cpp.

## DrawBlockEllipseFilled() [1/3]

void DrawBlockEllipseFilled | ( | int | x,
|  | int | y,
|  | int | r1,
|  | int | r2 )

Draw a filled ellipse made of block characters.

Parameters

  x | the x coordinate of the center of the ellipse.
  y | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.

Definition at line 719 of file src/ftxui/dom/canvas.cpp.

## DrawBlockEllipseFilled() [2/3]

void DrawBlockEllipseFilled | ( | int | x1,
|  | int | y1,
|  | int | r1,
|  | int | r2,
|  | const Stylizer & | s )

Draw a filled ellipse made of block characters.

Parameters

  x1 | the x coordinate of the center of the ellipse.
  y1 | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  s | the style of the ellipse.

Definition at line 744 of file src/ftxui/dom/canvas.cpp.

## DrawBlockEllipseFilled() [3/3]

void DrawBlockEllipseFilled | ( | int | x,
|  | int | y,
|  | int | r1,
|  | int | r2,
|  | const Color & | color )

Draw a filled ellipse made of block characters.

Parameters

  x | the x coordinate of the center of the ellipse.
  y | the y coordinate of the center of the ellipse.
  r1 | the radius of the ellipse along the x axis.
  r2 | the radius of the ellipse along the y axis.
  color | the color of the ellipse.

Definition at line 729 of file src/ftxui/dom/canvas.cpp.

## DrawText() [1/3]

void DrawText | ( | int | x,
|  | int | y,
|  | const std::string & | value )

Draw a piece of text.

Parameters

  x | the x coordinate of the text.
  y | the y coordinate of the text.
  value | the text to draw.

Definition at line 785 of file src/ftxui/dom/canvas.cpp.

## DrawText() [2/3]

void DrawText | ( | int | x,
|  | int | y,
|  | const std::string & | value,
|  | const Color & | color )

Draw a piece of text.

Parameters

  x | the x coordinate of the text.
  y | the y coordinate of the text.
  value | the text to draw.
  color | the color of the text.

Definition at line 794 of file src/ftxui/dom/canvas.cpp.

## DrawText() [3/3]

void DrawText | ( | int | x,
|  | int | y,
|  | const std::string & | value,
|  | const Stylizer & | style )

Draw a piece of text.

Parameters

  x | the x coordinate of the text.
  y | the y coordinate of the text.
  value | the text to draw.
  style | the style of the text.

Definition at line 806 of file src/ftxui/dom/canvas.cpp.

## DrawPixel()

void DrawPixel | ( | int | x,
|  | int | y,
|  | const Pixel & | p )

Directly draw a predefined pixel at the given coordinate.

Parameters

  x | the x coordinate of the pixel.
  y | the y coordinate of the pixel.
  p | the pixel to draw.

Definition at line 827 of file src/ftxui/dom/canvas.cpp.

## DrawImage()

void DrawImage | ( | int | x,
|  | int | y,
|  | const Image & | image )

Draw a predefined image, with top-left corner at the given coordinate You can supply negative coordinates to align the image however you like - only the 'visible' portion will be drawn.

Parameters

  x | the x coordinate corresponding to the top-left corner of the image.
  y | the y coordinate corresponding to the top-left corner of the image.
  image | the image to draw.

Definition at line 839 of file src/ftxui/dom/canvas.cpp.

## Style()

void Style | ( | int | x,
|  | int | y,
|  | const Stylizer & | style )

Modify a pixel at a given location.

Parameters

  style | a function that modifies the pixel.

Definition at line 861 of file src/ftxui/dom/canvas.cpp.

## ftxui::FlexboxConfig

struct ftxui::FlexboxConfig

FlexboxConfig is a configuration structure that defines the layout properties for a flexbox container.

It allows you to specify the direction of the flex items, whether they should wrap, how they should be justified along the main axis, and how they should be aligned along the cross axis. It also includes properties for gaps between flex items in both the main and cross axes. This structure is used to configure the layout behavior of flexbox containers in a terminal user interface.

Examples
  examples/component/flexbox_gallery.cpp, and examples/component/homescreen.cpp.

Definition at line 27 of file flexbox_config.hpp.

### Public Types

enum class | Direction { Row , RowInversed , Column , ColumnInversed }
enum class | Wrap { NoWrap , Wrap , WrapInversed }
enum class | JustifyContent { FlexStart , FlexEnd , Center , Stretch , SpaceBetween , SpaceAround , SpaceEvenly }
enum class | AlignItems { FlexStart , FlexEnd , Center , Stretch }
enum class | AlignContent { FlexStart , FlexEnd , Center , Stretch , SpaceBetween , SpaceAround , SpaceEvenly }

### Public Member Functions

FlexboxConfig & | Set (FlexboxConfig::Direction)
| Set the flexbox direction.
FlexboxConfig & | Set (FlexboxConfig::Wrap)
| Set the flexbox wrap.
FlexboxConfig & | Set (FlexboxConfig::JustifyContent)
| Set the flexbox justify content.
FlexboxConfig & | Set (FlexboxConfig::AlignItems)
| Set the flexbox align items.
FlexboxConfig & | Set (FlexboxConfig::AlignContent)
| Set the flexbox align content.
FlexboxConfig & | SetGap (int gap_x, int gap_y)
| Set the flexbox flex direction.

### Public Attributes

Direction | direction = Direction::Row
Wrap | wrap = Wrap::Wrap
JustifyContent | justify_content = JustifyContent::FlexStart
AlignItems | align_items = AlignItems::FlexStart
AlignContent | align_content = AlignContent::FlexStart
int | gap_x = 0
int | gap_y = 0

#### Member Enumeration Documentation

## Direction

enum class Direction

strong

This establishes the main-axis, thus defining the direction flex items are placed in the flex container. Flexbox is (aside wrapping) single-direction layout concept. Think of flex items as primarily laying out either in horizontal rows or vertical columns.

Enumerator
Row | Flex items are laid out in a row.
RowInversed | Flex items are laid out in a row, but in reverse order.
Column | Flex items are laid out in a column.
ColumnInversed | Flex items are laid out in a column, but in reverse order.

Definition at line 32 of file flexbox_config.hpp.

## Wrap

enum class Wrap

strong

By default, flex items will all try to fit onto one line. You can change that and allow the items to wrap as needed with this property.

Enumerator
NoWrap | Flex items will all try to fit onto one line.
Wrap | Flex items will wrap onto multiple lines.
WrapInversed | Flex items will wrap onto multiple lines, but in reverse order.

Definition at line 43 of file flexbox_config.hpp.

## JustifyContent

enum class JustifyContent

strong

This defines the alignment along the main axis. It helps distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow the line.

Enumerator
FlexStart | Items are aligned to the start of flexbox's direction.
FlexEnd | Items are aligned to the end of flexbox's direction.
Center | Items are centered along the line.
Stretch | Items are stretched to fill the line.
SpaceBetween | Items are evenly distributed in the line; first item is on the start.
SpaceAround | Items are evenly distributed in the line with equal space around them. Note that visually the spaces aren’t equal, since all the items have equal space on both sides. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies.
SpaceEvenly | Items are distributed so that the spacing between any two items (and the space to the edges) is equal.

Definition at line 56 of file flexbox_config.hpp.

## AlignItems

enum class AlignItems

strong

This defines the default behavior for how flex items are laid out along the cross axis on the current line. Think of it as the justify-content version for the cross-axis (perpendicular to the main-axis).

Enumerator
FlexStart | items are placed at the start of the cross axis.
FlexEnd | items are placed at the end of the cross axis.
Center | items are centered along the cross axis.
Stretch | items are stretched to fill the cross axis.

Definition at line 83 of file flexbox_config.hpp.

## AlignContent

enum class AlignContent

strong

Enumerator
FlexStart | items are placed at the start of the cross axis.
FlexEnd | items are placed at the end of the cross axis.
Center | items are centered along the cross axis.
Stretch | items are stretched to fill the cross axis.
SpaceBetween | items are evenly distributed in the cross axis.
SpaceAround | tems evenly distributed with equal space around each line.
SpaceEvenly | items are evenly distributed in the cross axis with equal space around them.

Definition at line 94 of file flexbox_config.hpp.

#### Member Function Documentation

## Set() [1/5]

FlexboxConfig & Set | ( | FlexboxConfig::Direction | d | ) |

Set the flexbox direction.

Examples
  examples/component/flexbox_gallery.cpp.

Definition at line 9 of file flexbox_config.cpp.

## Set() [2/5]

FlexboxConfig & Set | ( | FlexboxConfig::Wrap | w | ) |

Set the flexbox wrap.

Definition at line 15 of file flexbox_config.cpp.

## Set() [3/5]

FlexboxConfig & Set | ( | FlexboxConfig::JustifyContent | j | ) |

Set the flexbox justify content.

Definition at line 21 of file flexbox_config.cpp.

## Set() [4/5]

FlexboxConfig & Set | ( | FlexboxConfig::AlignItems | a | ) |

Set the flexbox align items.

Definition at line 27 of file flexbox_config.cpp.

## Set() [5/5]

FlexboxConfig & Set | ( | FlexboxConfig::AlignContent | a | ) |

Set the flexbox align content.

Definition at line 33 of file flexbox_config.cpp.

## SetGap()

FlexboxConfig & SetGap | ( | int | gap_x,
|  | int | gap_y )

Set the flexbox flex direction.

Examples
  examples/component/homescreen.cpp.

Definition at line 39 of file flexbox_config.cpp.

#### Member Data Documentation

## direction

Direction direction = Direction::Row

Examples
  examples/component/flexbox_gallery.cpp.

Definition at line 39 of file flexbox_config.hpp.

## wrap

Wrap wrap = Wrap::Wrap

Examples
  examples/component/flexbox_gallery.cpp.

Definition at line 49 of file flexbox_config.hpp.

## justify_content

JustifyContent justify_content = JustifyContent::FlexStart

Examples
  examples/component/flexbox_gallery.cpp.

Definition at line 78 of file flexbox_config.hpp.

## align_items

AlignItems align_items = AlignItems::FlexStart

Examples
  examples/component/flexbox_gallery.cpp.

Definition at line 89 of file flexbox_config.hpp.

## align_content

AlignContent align_content = AlignContent::FlexStart

Examples
  examples/component/flexbox_gallery.cpp.

Definition at line 105 of file flexbox_config.hpp.

## gap_x

int gap_x = 0

Definition at line 107 of file flexbox_config.hpp.

## gap_y

int gap_y = 0

Definition at line 108 of file flexbox_config.hpp.

## ftxui::LinearGradient

struct ftxui::LinearGradient

A class representing the settings for linear-gradient color effect.

Example:

LinearGradient()
.Angle(45)
.Stop(Color::Red, 0.0)
.Stop(Color::Green, 0.5)
.Stop(Color::Blue, 1.0);
ftxui::LinearGradient::LinearGradient
LinearGradient()
Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGrad...
ftxui::Color::Green
@ Green
Definition color.hpp:56
ftxui::Color::Red
@ Red
Definition color.hpp:55
ftxui::Color::Blue
@ Blue
Definition color.hpp:58

There are also shorthand constructors:

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

Examples
  examples/component/input_style.cpp, examples/component/linear_gradient_gallery.cpp, examples/dom/linear_gradient.cpp, and examples/dom/style_color.cpp.

Definition at line 32 of file linear_gradient.hpp.

### Public Member Functions

| LinearGradient ()
| Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example:
| LinearGradient (Color begin, Color end)
| Build a gradient with two colors.
| LinearGradient (float angle, Color begin, Color end)
| Build a gradient with two colors and an angle.
LinearGradient & | Angle (float angle)
| Set the angle of the gradient.
LinearGradient & | Stop (Color color, float position)
| Add a color stop to the gradient.
LinearGradient & | Stop (Color color)
| Add a color stop to the gradient.

### Public Attributes

float | angle = 0.f
std::vector< Stop > | stops

#### Constructor & Destructor Documentation

## LinearGradient() [1/3]

LinearGradient | ( |  | ) |

default

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

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

## LinearGradient() [2/3]

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.

Definition at line 197 of file src/ftxui/dom/linear_gradient.cpp.

## LinearGradient() [3/3]

LinearGradient | ( | float | a,
|  | 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.

Definition at line 204 of file src/ftxui/dom/linear_gradient.cpp.

#### Member Function Documentation

## Angle()

LinearGradient & Angle | ( | float | a | ) |

Set the angle of the gradient.

Parameters

  a | The angle of the gradient.

Returns
  The gradient.

Definition at line 212 of file src/ftxui/dom/linear_gradient.cpp.

## Stop() [1/2]

LinearGradient & Stop | ( | Color | c,
|  | float | p )

Add a color stop to the gradient.

Parameters

  c | The color of the stop.
  p | The position of the stop.

Definition at line 220 of file src/ftxui/dom/linear_gradient.cpp.

## Stop() [2/2]

LinearGradient & Stop | ( | Color | c | ) |

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.

Definition at line 229 of file src/ftxui/dom/linear_gradient.cpp.

#### Member Data Documentation

## angle

float angle = 0.f

Definition at line 33 of file linear_gradient.hpp.

## stops

std::vector<Stop> stops

Definition at line 43 of file linear_gradient.hpp.

## ftxui::Node

class ftxui::Node

Node is the base class for all elements in the DOM tree.

It represents a single node in the document object model (DOM) and provides the basic structure for layout and rendering. It contains methods for computing layout requirements, setting the box dimensions, selecting content, rendering to the screen, and checking the layout status. It typically contains child elements, which are also instances of Node.

Users are expected to derive from this class to create custom elements.

A list of builtin elements can be found in the `elements.hpp` file.

Definition at line 37 of file node.hpp.

Inheritance diagram for Node:
[legend]

### Public Member Functions

| Node ()
| Node (Elements children)
| Node (const Node &)=delete
| Node (const Node &&)=delete
Node & | operator= (const Node &)=delete
Node & | operator= (const Node &&)=delete
virtual | ~Node ()
virtual void | ComputeRequirement ()
| Compute how much space an element needs.
Requirement | requirement ()
virtual void | SetBox (Box box)
| Assign a position and a dimension to an element for drawing.
virtual void | Select (Selection &selection)
| Compute the selection of an element.
virtual void | Render (Screen &screen)
| Display an element on a ftxui::Screen.
virtual std::string | GetSelectedContent (Selection &selection)
virtual void | Check (Status *status)

### Protected Attributes

Elements | children_
Requirement | requirement_
Box | box_

#### Constructor & Destructor Documentation

## Node() [1/4]

Node | ( |  | ) |

default

## Node() [2/4]

Node | ( | Elements | children | ) |

explicit

Definition at line 16 of file node.cpp.

## Node() [3/4]

Node | ( | const Node & |  | ) |

delete

## Node() [4/4]

Node | ( | const Node && |  | ) |

delete

## ~Node()

~Node | ( |  | ) |

virtualdefault

#### Member Function Documentation

## operator=() [1/2]

Node & operator= | ( | const Node & |  | ) |

delete

## operator=() [2/2]

Node & operator= | ( | const Node && |  | ) |

delete

## ComputeRequirement()

void ComputeRequirement | ( |  | ) |

virtual

Compute how much space an element needs.

Reimplemented in NodeDecorator.

Definition at line 20 of file node.cpp.

## requirement()

Requirement requirement | ( |  | ) |

inline

Definition at line 52 of file node.hpp.

## SetBox()

void SetBox | ( | Box | box | ) |

virtual

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

Reimplemented in NodeDecorator.

Definition at line 41 of file node.cpp.

## Select()

void Select | ( | Selection & | selection | ) |

virtual

Compute the selection of an element.

Definition at line 46 of file node.cpp.

## Render()

void Render | ( | Screen & | screen | ) |

virtual

Display an element on a ftxui::Screen.

Definition at line 59 of file node.cpp.

## GetSelectedContent()

std::string GetSelectedContent | ( | Selection & | selection | ) |

virtual

Definition at line 72 of file node.cpp.

## Check()

void Check | ( | Status * | status | ) |

virtual

Definition at line 65 of file node.cpp.

#### Member Data Documentation

## children_

Elements children_

protected

Definition at line 79 of file node.hpp.

## requirement_

Requirement requirement_

protected

Definition at line 80 of file node.hpp.

## box_

Box box_

protected

Definition at line 81 of file node.hpp.

## ftxui::Requirement

struct ftxui::Requirement

Requirement is a structure that defines the layout requirements for a Node in the terminal user interface.

It specifies the minimum size required to fully draw the element,

Definition at line 18 of file requirement.hpp.

### Public Attributes

int | min_x = 0
int | min_y = 0
int | flex_grow_x = 0
int | flex_grow_y = 0
int | flex_shrink_x = 0
int | flex_shrink_y = 0
Focused | focused

#### Member Data Documentation

## min_x

int min_x = 0

Definition at line 20 of file requirement.hpp.

## min_y

int min_y = 0

Definition at line 21 of file requirement.hpp.

## flex_grow_x

int flex_grow_x = 0

Definition at line 24 of file requirement.hpp.

## flex_grow_y

int flex_grow_y = 0

Definition at line 25 of file requirement.hpp.

## flex_shrink_x

int flex_shrink_x = 0

Definition at line 26 of file requirement.hpp.

## flex_shrink_y

int flex_shrink_y = 0

Definition at line 27 of file requirement.hpp.

## focused

Focused focused

Definition at line 51 of file requirement.hpp.

## ftxui::Selection

class ftxui::Selection

Represents a selection in a terminal user interface.

Selection is a class that represents the two endpoints of a selection in a terminal user interface.

Definition at line 22 of file selection.hpp.

### Public Member Functions

| Selection ()
| Create an empty selection.
| Selection (int start_x, int start_y, int end_x, int end_y)
| Create a selection.
const Box & | GetBox () const
| Get the box of the selection.
Selection | SaturateHorizontal (Box box)
| Saturate the selection to be inside the box. This is called by `hbox` to propagate the selection to its children.
Selection | SaturateVertical (Box box)
| Saturate the selection to be inside the box. This is called by `vbox` to propagate the selection to its children.
bool | IsEmpty () const
void | AddPart (const std::string &part, int y, int left, int right)
std::string | GetParts ()

#### Constructor & Destructor Documentation

## Selection() [1/2]

Selection | ( |  | ) |

default

Create an empty selection.

## Selection() [2/2]

Selection | ( | int | start_x,
|  | int | start_y,
|  | int | end_x,
|  | int | end_y )

Create a selection.

Parameters

  start_x | The x coordinate of the start of the selection.
  start_y | The y coordinate of the start of the selection.
  end_x | The x coordinate of the end of the selection.
  end_y | The y coordinate of the end of the selection.

Definition at line 34 of file src/ftxui/dom/selection.cpp.

#### Member Function Documentation

## GetBox()

const Box & GetBox | ( |  | ) | const

Get the box of the selection.

Returns
  The box of the selection.

Definition at line 67 of file src/ftxui/dom/selection.cpp.

## SaturateHorizontal()

Selection SaturateHorizontal | ( | Box | box | ) |

Saturate the selection to be inside the box. This is called by `hbox` to propagate the selection to its children.

Parameters

  box | The box to saturate the selection in.

Returns
  The saturated selection.

Definition at line 75 of file src/ftxui/dom/selection.cpp.

## SaturateVertical()

Selection SaturateVertical | ( | Box | box | ) |

Saturate the selection to be inside the box. This is called by `vbox` to propagate the selection to its children.

Parameters

  box | The box to saturate the selection in.

Returns
  The saturated selection.

Definition at line 113 of file src/ftxui/dom/selection.cpp.

## IsEmpty()

bool IsEmpty | ( |  | ) | const

inline

Definition at line 31 of file selection.hpp.

## AddPart()

void AddPart | ( | const std::string & | part,
|  | int | y,
|  | int | left,
|  | int | right )

Definition at line 146 of file src/ftxui/dom/selection.cpp.

## GetParts()

std::string GetParts | ( |  | ) |

inline

Definition at line 34 of file selection.hpp.

## ftxui::Table

class ftxui::Table

Table is a utility to draw tables.

example

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();
ftxui::Table::Table
Table()
Create an empty table.
Definition src/ftxui/dom/table.cpp:47
ftxui::DOUBLE
@ DOUBLE
Definition elements.hpp:39
ftxui::LIGHT
@ LIGHT
Definition elements.hpp:36

Examples
  examples/dom/table.cpp.

Definition at line 36 of file table.hpp.

### Public Member Functions

| Table ()
| Create an empty table.
| Table (std::vector< std::vector< std::string > >)
| Create a table from a vector of vector of string.
| Table (std::vector< std::vector< Element > >)
| Create a table from a vector of vector of Element.
| Table (std::initializer_list< std::vector< std::string > > init)
TableSelection | SelectAll ()
| Select all the table.
TableSelection | SelectCell (int column, int row)
| Select a cell of the table.
TableSelection | SelectRow (int row_index)
| Select a row of the table.
TableSelection | SelectRows (int row_min, int row_max)
| Select a range of rows of the table.
TableSelection | SelectColumn (int column_index)
| Select a column of the table.
TableSelection | SelectColumns (int column_min, int column_max)
| Select a range of columns of the table.
TableSelection | SelectRectangle (int column_min, int column_max, int row_min, int row_max)
| Select a rectangle of the table.
Element | Render ()
| Render the table.

#### Constructor & Destructor Documentation

## Table() [1/4]

Table | ( |  | ) |

Create an empty table.

Definition at line 47 of file src/ftxui/dom/table.cpp.

## Table() [2/4]

Table | ( | std::vector< std::vector< std::string > > | input | ) |

explicit

Create a table from a vector of vector of string.

Parameters

  input | The input data.

Definition at line 53 of file src/ftxui/dom/table.cpp.

## Table() [3/4]

Table | ( | std::vector< std::vector< Element > > | input | ) |

explicit

Create a table from a vector of vector of Element.

Parameters

  input | The input elements.

Definition at line 69 of file src/ftxui/dom/table.cpp.

## Table() [4/4]

Table | ( | std::initializer_list< std::vector< std::string > > | init | ) |

Definition at line 75 of file src/ftxui/dom/table.cpp.

#### Member Function Documentation

## SelectAll()

TableSelection SelectAll | ( |  | ) |

Select all the table.

Examples
  examples/dom/table.cpp.

Definition at line 200 of file src/ftxui/dom/table.cpp.

## SelectCell()

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.

Definition at line 169 of file src/ftxui/dom/table.cpp.

## SelectRow()

TableSelection SelectRow | ( | int | 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.

Definition at line 138 of file src/ftxui/dom/table.cpp.

## SelectRows()

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.

Definition at line 146 of file src/ftxui/dom/table.cpp.

## SelectColumn()

TableSelection SelectColumn | ( | int | 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.

Definition at line 153 of file src/ftxui/dom/table.cpp.

## SelectColumns()

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.

Definition at line 161 of file src/ftxui/dom/table.cpp.

## SelectRectangle()

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.

Definition at line 179 of file src/ftxui/dom/table.cpp.

## Render()

Element Render | ( |  | ) |

Render the table.

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

Definition at line 212 of file src/ftxui/dom/table.cpp.

## Enumeration Type Documentation

## Direction

enum class Direction

strong

Direction is an enumeration that represents the four cardinal directions.

Enumerator
Up |
Down |
Left |
Right |

Definition at line 13 of file direction.hpp.

## BorderStyle

enum BorderStyle

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.

Enumerator
LIGHT |
DASHED |
HEAVY |
DOUBLE |
ROUNDED |
EMPTY |

Definition at line 35 of file elements.hpp.

## Function Documentation

## automerge()

Element automerge | ( | Element | child | ) |

Enable character to be automatically merged with others nearby.

Definition at line 17 of file automerge.cpp.

## blink()

Element blink | ( | Element | child | ) |

The text drawn alternates in between visible and hidden.

Definition at line 33 of file blink.cpp.

## bold()

Element bold | ( | Element | child | ) |

Use a bold font, for elements with more emphasis.

Definition at line 33 of file bold.cpp.

## border()

Element border | ( | Element | child | ) |

Draw a border around the element.

See also
  border
  borderLight
  borderDashed
  borderDouble
  borderHeavy
  borderEmpty
  borderRounded
  borderStyled
  borderWith

Add a border around an element

### Example

// Use 'border' as a function...
Element document = border(text("The element"));
// ...Or as a 'pipe'.
Element document = text("The element") | border;
ftxui::text
Element text(std::wstring text)
Display a piece of unicode text.
Definition text.cpp:160
ftxui::border
Element border(Element)
Draw a border around the element.
Definition src/ftxui/dom/border.cpp:227
ftxui::Element
std::shared_ptr< Node > Element
Definition elements.hpp:22

### Output

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

Definition at line 227 of file src/ftxui/dom/border.cpp.

## borderWith()

Decorator borderWith | ( | const Pixel & | pixel | ) |

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

See also
  border

Definition at line 234 of file src/ftxui/dom/border.cpp.

## borderStyled() [1/3]

Decorator borderStyled | ( | BorderStyle | style | ) |

Same as border but with different styles.

See also
  border

Definition at line 243 of file src/ftxui/dom/border.cpp.

## borderStyled() [2/3]

Decorator borderStyled | ( | Color | foreground_color | ) |

Same as border but with a foreground color.

See also
  border

Definition at line 252 of file src/ftxui/dom/border.cpp.

## borderStyled() [3/3]

Decorator borderStyled | ( | BorderStyle | style,
|  | Color | foreground_color )

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

See also
  border

Definition at line 262 of file src/ftxui/dom/border.cpp.

## borderDashed()

Element borderDashed | ( | Element | child | ) |

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

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

### Output

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

Definition at line 300 of file src/ftxui/dom/border.cpp.

## borderLight()

Element borderLight | ( | Element | child | ) |

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

// Use 'borderLight' as a function...
Element document = borderLight(text("The element"));
// ...Or as a 'pipe'.
Element document = text("The element") | borderLight;
ftxui::borderLight
Element borderLight(Element)
Draw a light border around the element.
Definition src/ftxui/dom/border.cpp:335

### Output

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

Definition at line 335 of file src/ftxui/dom/border.cpp.

## borderHeavy()

Element borderHeavy | ( | Element | child | ) |

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

// Use 'borderHeavy' as a function...
Element document = borderHeavy(text("The element"));
// ...Or as a 'pipe'.
Element document = text("The element") | borderHeavy;
ftxui::borderHeavy
Element borderHeavy(Element)
Draw a heavy border around the element.
Definition src/ftxui/dom/border.cpp:370

### Output

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

Definition at line 370 of file src/ftxui/dom/border.cpp.

## borderDouble()

Element borderDouble | ( | Element | child | ) |

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

// Use 'borderDouble' as a function...
Element document = borderDouble(text("The element"));
// ...Or as a 'pipe'.
Element document = text("The element") | borderDouble;
ftxui::borderDouble
Element borderDouble(Element)
Draw a double border around the element.
Definition src/ftxui/dom/border.cpp:405

### Output

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

Definition at line 405 of file src/ftxui/dom/border.cpp.

## borderRounded()

Element borderRounded | ( | Element | child | ) |

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

// Use 'borderRounded' as a function...
Element document = borderRounded(text("The element"));
// ...Or as a 'pipe'.
Element document = text("The element") | borderRounded;
ftxui::borderRounded
Element borderRounded(Element)
Draw a rounded border around the element.
Definition src/ftxui/dom/border.cpp:440

### Output

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

Definition at line 440 of file src/ftxui/dom/border.cpp.

## borderEmpty()

Element borderEmpty | ( | Element | child | ) |

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

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

### Output

The element

Definition at line 475 of file src/ftxui/dom/border.cpp.

## window()

Element window | ( | Element | title,
|  | Element | content,
|  | BorderStyle | border )

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

Element document = window(text("Title"),
text("content")
);
// With specifying border
Element document = window(text("Title"),
text("content"),
ROUNDED
);
ftxui::window
Element window(Element title, Element content, BorderStyle border=ROUNDED)
Draw window with a title and a border around the element.
Definition src/ftxui/dom/border.cpp:507
ftxui::ROUNDED
@ ROUNDED
Definition elements.hpp:40

### Output

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

Definition at line 507 of file src/ftxui/dom/border.cpp.

## clear_under()

Element clear_under | ( | Element | element | ) |

Before drawing |child|, clear the pixels below. This is useful in combination with dbox.

See also
  ftxui::dbox

Definition at line 38 of file clear_under.cpp.

## color() [1/4]

Element color | ( | Color | color,
|  | Element | child )

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

Element document = color(Color::Green, text("Success")),
ftxui::color
Decorator color(Color)
Decorate using a foreground color.
Definition dom/color.cpp:110

Definition at line 81 of file dom/color.cpp.

## bgcolor() [1/4]

Element bgcolor | ( | Color | color,
|  | Element | child )

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

Element document = bgcolor(Color::Green, text("Success")),
ftxui::bgcolor
Decorator bgcolor(Color)
Decorate using a background color.
Definition dom/color.cpp:124

Definition at line 96 of file dom/color.cpp.

## color() [2/4]

Decorator color | ( | Color | c | ) |

Decorate using a foreground color.

Parameters

  c | The foreground color to be applied.

Returns
  The Decorator applying the color.

### Example

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

Definition at line 110 of file dom/color.cpp.

## bgcolor() [2/4]

Decorator bgcolor | ( | Color | color | ) |

Decorate using a background color.

Parameters

  color | The background color to be applied.

Returns
  The Decorator applying the color.

### Example

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

Definition at line 124 of file dom/color.cpp.

## hcenter()

Element hcenter | ( | Element | child | ) |

Center an element horizontally.

Parameters

  child | The decorated element.

Returns
  The centered element.

Definition at line 15 of file composite_decorator.cpp.

## vcenter()

Element vcenter | ( | Element | child | ) |

Center an element vertically.

Parameters

  child | The decorated element.

Returns
  The centered element.

Definition at line 23 of file composite_decorator.cpp.

## center()

Element center | ( | Element | child | ) |

Center an element horizontally and vertically.

Parameters

  child | The decorated element.

Returns
  The centered element.

Definition at line 31 of file composite_decorator.cpp.

## align_right()

Element align_right | ( | Element | child | ) |

Align an element on the right side.

Parameters

  child | The decorated element.

Returns
  The right aligned element.

Definition at line 39 of file composite_decorator.cpp.

## dbox()

Element dbox | ( | Elements | children_ | ) |

Stack several element on top of each other.

Parameters

  children_ | The input element.

Returns
  The right aligned element.

Definition at line 55 of file src/ftxui/dom/dbox.cpp.

## dim()

Element dim | ( | Element | child | ) |

Use a light font, for elements with less emphasis.

Definition at line 33 of file dim.cpp.

## filler()

Element filler | ( |  | ) |

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

Definition at line 98 of file flex.cpp.

## flex()

Element flex | ( | Element | child | ) |

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

#### Examples:

hbox({
text("left") | border ,
text("middle") | border | flex,
text("right") | border,
});
ftxui::flex
Element flex(Element)
Make a child element to expand proportionally to the space left in a container.
Definition flex.cpp:123
ftxui::hbox
Element hbox(Elements)
A container displaying elements horizontally one by one.
Definition hbox.cpp:94

#### Output:

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

Definition at line 123 of file flex.cpp.

## xflex()

Element xflex | ( | Element | child | ) |

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

Definition at line 129 of file flex.cpp.

## yflex()

Element yflex | ( | Element | child | ) |

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

Definition at line 135 of file flex.cpp.

## flex_grow()

Element flex_grow | ( | Element | child | ) |

Expand if possible.

Definition at line 141 of file flex.cpp.

## xflex_grow()

Element xflex_grow | ( | Element | child | ) |

Expand if possible on the X axis.

Definition at line 147 of file flex.cpp.

## yflex_grow()

Element yflex_grow | ( | Element | child | ) |

Expand if possible on the Y axis.

Definition at line 153 of file flex.cpp.

## flex_shrink()

Element flex_shrink | ( | Element | child | ) |

Minimize if needed.

Definition at line 159 of file flex.cpp.

## xflex_shrink()

Element xflex_shrink | ( | Element | child | ) |

Minimize if needed on the X axis.

Definition at line 165 of file flex.cpp.

## yflex_shrink()

Element yflex_shrink | ( | Element | child | ) |

Minimize if needed on the Y axis.

Definition at line 171 of file flex.cpp.

## notflex()

Element notflex | ( | Element | child | ) |

Make the element not flexible.

Definition at line 177 of file flex.cpp.

## focusPositionRelative()

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

Element document = huge_document()
| focusPositionRelative(0.f, 1.f)
| frame;
ftxui::focusPositionRelative
Decorator focusPositionRelative(float x, float y)
Used inside a frame, this force the view to be scrolled toward a a given position....
Definition src/ftxui/dom/focus.cpp:31
ftxui::frame
Element frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
Definition frame.cpp:118

Definition at line 31 of file src/ftxui/dom/focus.cpp.

## focusPosition()

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

Element document = huge_document()
| focusPosition(10, 10)
| frame;
ftxui::focusPosition
Decorator focusPosition(int x, int y)
Used inside a frame, this force the view to be scrolled toward a a given position....
Definition src/ftxui/dom/focus.cpp:69

Definition at line 69 of file src/ftxui/dom/focus.cpp.

## focus()

Element focus | ( | Element | child | ) |

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

Parameters

  child | The element to be focused.

Definition at line 101 of file frame.cpp.

## focusCursorBlock()

Element focusCursorBlock | ( | Element | child | ) |

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

See also
  focus
  focusCursorBlock
  focusCursorBlockBlinking
  focusCursorBar
  focusCursorBarBlinking
  focusCursorUnderline
  focusCursorUnderlineBlinking

Definition at line 147 of file frame.cpp.

## focusCursorBlockBlinking()

Element focusCursorBlockBlinking | ( | Element | child | ) |

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

See also
  focus
  focusCursorBlock
  focusCursorBlockBlinking
  focusCursorBar
  focusCursorBarBlinking
  focusCursorUnderline
  focusCursorUnderlineBlinking

Definition at line 161 of file frame.cpp.

## focusCursorBar()

Element focusCursorBar | ( | Element | child | ) |

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

See also
  focus
  focusCursorBlock
  focusCursorBlockBlinking
  focusCursorBar
  focusCursorBarBlinking
  focusCursorUnderline
  focusCursorUnderlineBlinking

Definition at line 175 of file frame.cpp.

## focusCursorBarBlinking()

Element focusCursorBarBlinking | ( | Element | child | ) |

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

See also
  focus
  focusCursorBlock
  focusCursorBlockBlinking
  focusCursorBar
  focusCursorBarBlinking
  focusCursorUnderline
  focusCursorUnderlineBlinking

Definition at line 189 of file frame.cpp.

## focusCursorUnderline()

Element focusCursorUnderline | ( | Element | child | ) |

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

See also
  focus
  focusCursorBlock
  focusCursorBlockBlinking
  focusCursorBar
  focusCursorBarBlinking
  focusCursorUnderline
  focusCursorUnderlineBlinking

Definition at line 203 of file frame.cpp.

## focusCursorUnderlineBlinking()

Element focusCursorUnderlineBlinking | ( | Element | child | ) |

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

See also
  focus
  focusCursorBlock
  focusCursorBlockBlinking
  focusCursorBar
  focusCursorBarBlinking
  focusCursorUnderline
  focusCursorUnderlineBlinking

Definition at line 217 of file frame.cpp.

## gaugeDirection()

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].
  direction | Direction of progress bars progression.

Definition at line 169 of file src/ftxui/dom/gauge.cpp.

## gaugeRight()

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].

### Example

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

border(gaugeRight(0.5))
ftxui::gaugeRight
Element gaugeRight(float progress)
Draw a high definition progress bar progressing from left to right.
Definition src/ftxui/dom/gauge.cpp:191

#### Output

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

Definition at line 191 of file src/ftxui/dom/gauge.cpp.

## gaugeLeft()

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].

### Example

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

border(gaugeLeft(0.5))
ftxui::gaugeLeft
Element gaugeLeft(float progress)
Draw a high definition progress bar progressing from right to left.
Definition src/ftxui/dom/gauge.cpp:213

#### Output

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

Definition at line 213 of file src/ftxui/dom/gauge.cpp.

## gaugeUp()

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].

### Example

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

border(gaugeUp(0.5))
ftxui::gaugeUp
Element gaugeUp(float progress)
Draw a high definition progress bar progressing from bottom to top.
Definition src/ftxui/dom/gauge.cpp:242

#### Output

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

Definition at line 242 of file src/ftxui/dom/gauge.cpp.

## gaugeDown()

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].

### Example

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

border(gaugeDown(0.5))
ftxui::gaugeDown
Element gaugeDown(float progress)
Draw a high definition progress bar progressing from top to bottom.
Definition src/ftxui/dom/gauge.cpp:271

#### Output

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

Definition at line 271 of file src/ftxui/dom/gauge.cpp.

## gauge()

Element gauge | ( | float | progress | ) |

Draw a high definition progress bar.

Parameters

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

### Example

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

border(gauge(0.5))
ftxui::gauge
Element gauge(float progress)
Draw a high definition progress bar.
Definition src/ftxui/dom/gauge.cpp:293

#### Output

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

Definition at line 293 of file src/ftxui/dom/gauge.cpp.

## hyperlink() [1/2]

Element hyperlink | ( | std::string | link,
|  | Element | child )

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

Parameters

  link | The link
  child | The input element.

Returns
  The output element with the link.

### Example

Element document =
hyperlink("https://github.com/ArthurSonzogni/FTXUI", "link");
ftxui::hyperlink
Decorator hyperlink(std::string link)
Decorate using a hyperlink. The link will be opened when the user clicks on it. This is supported onl...
Definition hyperlink.cpp:70

Definition at line 51 of file hyperlink.cpp.

## hyperlink() [2/2]

Decorator hyperlink | ( | std::string | link | ) |

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

Parameters

  link | The link to redirect the users to.

Returns
  The Decorator applying the hyperlink.

### Example

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

Definition at line 70 of file hyperlink.cpp.

## inverted()

Element inverted | ( | Element | child | ) |

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

Definition at line 34 of file inverted.cpp.

## italic()

Element italic | ( | Element | child | ) |

Apply a underlinedDouble to text.

Definition at line 17 of file italic.cpp.

## color() [3/4]

Element color | ( | const LinearGradient & | gradient,
|  | Element | child )

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

color(LinearGradient{0, {Color::Red, Color::Blue}}, text("Hello"))
ftxui::LinearGradient
A class representing the settings for linear-gradient color effect.
Definition linear_gradient.hpp:32

Definition at line 245 of file src/ftxui/dom/linear_gradient.cpp.

## bgcolor() [3/4]

Element bgcolor | ( | const LinearGradient & | gradient,
|  | Element | child )

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

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

Definition at line 261 of file src/ftxui/dom/linear_gradient.cpp.

## color() [4/4]

Decorator color | ( | const LinearGradient & | gradient | ) |

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

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

Definition at line 276 of file src/ftxui/dom/linear_gradient.cpp.

## bgcolor() [4/4]

Decorator bgcolor | ( | const LinearGradient & | gradient | ) |

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

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

Definition at line 291 of file src/ftxui/dom/linear_gradient.cpp.

## Render() [1/2]

void Render | ( | Screen & | screen,
|  | const Element & | element )

Display an element on a ftxui::Screen.

Definition at line 84 of file node.cpp.

## Render() [2/2]

void Render | ( | Screen & | screen,
|  | Node * | node )

Display an element on a ftxui::Screen.

Definition at line 91 of file node.cpp.

## paragraph()

Element paragraph | ( | const std::string & | the_text | ) |

Return an element drawing the paragraph on multiple lines.

See also
  flexbox.

Definition at line 41 of file src/ftxui/dom/paragraph.cpp.

## paragraphAlignLeft()

Element paragraphAlignLeft | ( | const std::string & | the_text | ) |

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

See also
  flexbox.

Definition at line 49 of file src/ftxui/dom/paragraph.cpp.

## paragraphAlignRight()

Element paragraphAlignRight | ( | const std::string & | the_text | ) |

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

See also
  flexbox.

Definition at line 60 of file src/ftxui/dom/paragraph.cpp.

## paragraphAlignCenter()

Element paragraphAlignCenter | ( | const std::string & | the_text | ) |

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

See also
  flexbox.

Definition at line 72 of file src/ftxui/dom/paragraph.cpp.

## paragraphAlignJustify()

Element paragraphAlignJustify | ( | const std::string & | the_text | ) |

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

See also
  flexbox.

Definition at line 85 of file src/ftxui/dom/paragraph.cpp.

## vscroll_indicator()

Element vscroll_indicator | ( | Element | child | ) |

Display a vertical scrollbar on the right. Colors follow the content.

Definition at line 21 of file scroll_indicator.cpp.

## hscroll_indicator()

Element hscroll_indicator | ( | Element | child | ) |

Display a horizontal scrollbar at the bottom. Colors follow the content.

Definition at line 76 of file scroll_indicator.cpp.

## separator() [1/2]

Element 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

// Use 'border' as a function...
Element document = vbox({
text("up"),
separator(),
text("down"),
});
ftxui::separator
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Definition src/ftxui/dom/separator.cpp:134
ftxui::vbox
Element vbox(Elements)
A container displaying elements vertically one by one.
Definition vbox.cpp:96

### Output

up
────
down

Definition at line 134 of file src/ftxui/dom/separator.cpp.

## separatorStyled()

Element separatorStyled | ( | BorderStyle | style | ) |

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

// Use 'border' as a function...
Element document = vbox({
text("up"),
separatorStyled(DOUBLE),
text("down"),
});
ftxui::separatorStyled
Element separatorStyled(BorderStyle)
Draw a vertical or horizontal separation in between two other elements.
Definition src/ftxui/dom/separator.cpp:172

### Output

up
════
down

Definition at line 172 of file src/ftxui/dom/separator.cpp.

## separatorLight()

Element 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

// Use 'border' as a function...
Element document = vbox({
text("up"),
separatorLight(),
text("down"),
});
ftxui::separatorLight
Element separatorLight()
Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.
Definition src/ftxui/dom/separator.cpp:209

### Output

up
────
down

Definition at line 209 of file src/ftxui/dom/separator.cpp.

## separatorDashed()

Element 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

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

### Output

up
╍╍╍╍
down

Definition at line 246 of file src/ftxui/dom/separator.cpp.

## separatorHeavy()

Element 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

// Use 'border' as a function...
Element document = vbox({
text("up"),
separatorHeavy(),
text("down"),
});
ftxui::separatorHeavy
Element separatorHeavy()
Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.
Definition src/ftxui/dom/separator.cpp:283

### Output

up
━━━━
down

Definition at line 283 of file src/ftxui/dom/separator.cpp.

## separatorDouble()

Element 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

// Use 'border' as a function...
Element document = vbox({
text("up"),
separatorDouble(),
text("down"),
});
ftxui::separatorDouble
Element separatorDouble()
Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
Definition src/ftxui/dom/separator.cpp:320

### Output

up
════
down

Definition at line 320 of file src/ftxui/dom/separator.cpp.

## separatorEmpty()

Element 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

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

### Output

up
down

Definition at line 357 of file src/ftxui/dom/separator.cpp.

## separatorCharacter()

Element separatorCharacter | ( | std::string | value | ) |

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

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

### Output

up
────
down

Definition at line 395 of file src/ftxui/dom/separator.cpp.

## separator() [2/2]

Element separator | ( | Pixel | pixel | ) |

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

See also
  separator
  separatorLight
  separatorDashed
  separatorHeavy
  separatorDouble
  separatorStyled

### Example

Pixel empty;
Element document = vbox({
text("Up"),
separator(empty),
text("Down"),
})
ftxui::Pixel
A Unicode character and its associated style.
Definition pixel.hpp:15

### Output

Up
Down

Definition at line 426 of file src/ftxui/dom/separator.cpp.

## size()

Decorator size | ( | WidthOrHeight | direction,
|  | Constraint | constraint,
|  | int | value )

Apply a constraint on the size of an element.

Parameters

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

Definition at line 89 of file src/ftxui/dom/size.cpp.

## spinner()

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".

Parameters

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

Definition at line 282 of file src/ftxui/dom/spinner.cpp.

## strikethrough()

Element strikethrough | ( | Element | child | ) |

Apply a strikethrough to text.

Definition at line 17 of file strikethrough.cpp.

## text() [1/2]

Element text | ( | std::string | text | ) |

Display a piece of UTF8 encoded unicode text.

See also
  ftxui::to_wstring

### Example

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

### Output

Hello world!

Definition at line 141 of file text.cpp.

## text() [2/2]

Element text | ( | std::wstring | text | ) |

Display a piece of unicode text.

See also
  ftxui::to_wstring

### Example

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

### Output

Hello world!

Definition at line 160 of file text.cpp.

## vtext() [1/2]

Element vtext | ( | std::string | text | ) |

Display a piece of unicode text vertically.

See also
  ftxui::to_wstring

### Example

Element document = vtext("Hello world!");
ftxui::vtext
Element vtext(std::wstring text)
Display a piece unicode text vertically.
Definition text.cpp:220

### Output

H
e
l
l
o
w
o
r
l
d
!

Definition at line 190 of file text.cpp.

## vtext() [2/2]

Element vtext | ( | std::wstring | text | ) |

Display a piece unicode text vertically.

See also
  ftxui::to_wstring

### Example

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

### Output

H
e
l
l
o
w
o
r
l
d
!

Definition at line 220 of file text.cpp.

## underlined()

Element underlined | ( | Element | child | ) |

Underline the given element.

Definition at line 33 of file underlined.cpp.

## underlinedDouble()

Element underlinedDouble | ( | Element | child | ) |

Apply a underlinedDouble to text.

Definition at line 17 of file underlined_double.cpp.

## nothing()

Element nothing | ( | Element | element | ) |

A decoration doing absolutely nothing.

Definition at line 28 of file dom/util.cpp.

## operator|() [1/3]

Decorator operator| | ( | Decorator | a,
|  | Decorator | b )

Compose two decorator into one.

### Example

auto decorator = bold | blink;
ftxui::blink
Element blink(Element)
The text drawn alternates in between visible and hidden.
Definition blink.cpp:33

Definition at line 40 of file dom/util.cpp.

## operator|() [2/3]

Elements operator| | ( | Elements | elements,
|  | Decorator | decorator )

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

Returns
  the set of decorated element.

Definition at line 48 of file dom/util.cpp.

## operator|() [3/3]

Element operator| | ( | Element | element,
|  | Decorator | decorator )

From an element, apply a decorator.

Returns
  the decorated element.

### Example

Both of these are equivalent:

bold(text("Hello"));
ftxui::bold
Element bold(Element)
Use a bold font, for elements with more emphasis.
Definition bold.cpp:33
text("Hello") | bold;

Definition at line 70 of file dom/util.cpp.

## operator|=()

Element & operator|= | ( | Element & | e,
|  | Decorator | d )

Apply a decorator to an element.

Returns
  the decorated element.

### Example

Both of these are equivalent:

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

Definition at line 85 of file dom/util.cpp.

## emptyElement()

Element emptyElement | ( |  | ) |

An element of size 0x0 drawing nothing.

Definition at line 140 of file dom/util.cpp.

## vbox()

Element vbox | ( | Elements | children | ) |

A container displaying elements vertically one by one.

Parameters

  children | The elements in the container

Returns
  The container.

#### Example

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

Definition at line 96 of file vbox.cpp.

## SetColorSupport()

void SetColorSupport | ( | Color | color | ) |

Override terminal color support in case auto-detection fails.

Definition at line 140 of file terminal.cpp.