Skip to content
You are viewing documentation for v0.11. Switch to latest (main).

API Reference ​

FTXUI is layered into three modules: Screen (ftxui/screen), Elements (ftxui/dom), and Components (ftxui/component).

Screen (ftxui/screen) ​

  • ftxui::Screen: A rectangular grid of styled cells rendered to the terminal.
  • ftxui::Pixel: A single Unicode grapheme and its foreground/background style.
  • ftxui::Color: Terminal color supporting Palette16, Palette256, and 24-bit TrueColor (RGB/HSV).
  • ftxui::Box: Inclusive 2D bounding rectangle (x_min, x_max, y_min, y_max).

(Additional terminal & string utilities are available in the ftxui/screen module reference.)

Elements (ftxui/dom) ​

Text & Paragraphs ​

Layout & Containers ​

  • hbox: A container displaying elements horizontally one by one.
  • vbox: A container displaying elements vertically one by one.
  • dbox: Stack several element on top of each other.
  • hflow: A container displaying elements horizontally one by one.
  • gridbox: A container displaying a grid of elements.
  • filler: An element that will take expand proportionnally to the space left in a container.
  • emptyElement: An element of size 0x0 drawing nothing.

Borders, Windows & Separators ​

Data Visualization & Drawing ​

  • gauge: Draw a high definition progress bar.
  • graph: Draw a graph using a GraphFunction.
  • spinner: Useful to represent the effect of time and/or events. This display an ASCII art "video".

Styling & Color ​

  • color (variants: bgcolor): Set the foreground color of an element.
  • bold: Use a bold font, for elements with more emphasis.
  • dim: Use a light font, for elements with less emphasis.
  • inverted: Add a filter that will invert the foreground and the background colors.
  • underlined: Make the underlined element to be underlined.
  • blink: The text drawn alternates in between visible and hidden.

Flexibility & Sizing ​

Alignment, Layering & Utilities ​

Scrolling & Focus ​

  • frame: Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container. In this case only a smaller portion is displayed. The view is scrollable to make the focused element visible.
  • vscroll_indicator: Add a filter that will invert the foreground and the background colors.

Other ​

Components (ftxui/component) ​

Interactive Controls ​

  • Button: Draw a button. Execute a function when clicked.
  • Checkbox: Draw checkable element.
  • Input: An input box for editing text.
  • Menu: A list of text. The focused element is selected.
  • Radiobox: A list of element, where only one can be selected.
  • Toggle: An horizontal list of elements. The user can navigate through them.
  • Slider: An horizontal slider.

Containers & Splits ​

Composition & Overlays ​

  • Renderer: Return a component, using render to render its interface.

Other ​

Core Classes ​

(Component option/state structs like ButtonOption, MenuOption, InputOption, WindowOptions, etc. are linked directly from the functions that accept them.)

ClassDescription
ftxui::Box
ftxui::ColorA class representing terminal colors.
ftxui::ComponentBaseIt implement rendering itself as ftxui::Element. It implement keyboard navigation by responding to ftxui::Event.
ftxui::EventRepresent an event. It can be key press event, a terminal resize, or more ...
ftxui::MouseA mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift, ctrl, meta).
ftxui::Node
ftxui::PixelA unicode character and its associated style.
ftxui::Requirement
ftxui::ScreenA rectangular grid of Pixel.
ftxui::ScreenInteractive
ftxui::Table
ftxui::TableSelection
ftxui::WideStringRefAn adapter. Own or reference a constant string. For convenience, this class convert multiple mutable string toward a shared representation.