Skip to content
You are viewing documentation for v6.1.3. 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::Image: Base 2D grid of Pixels.
  • 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.
  • gridbox: A container displaying a grid of elements.
  • filler: An element that will take expand proportionally to the space left in a container.
  • emptyElement: An element of size 0x0 drawing nothing.

Borders, Windows & Separators ​

Data Visualization & Drawing ​

Styling & Color ​

Flexibility & Sizing ​

Alignment, Layering & Utilities ​

Scrolling & Focus ​

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 (variants: MenuEntry): A list of text. The focused element is selected.
  • Radiobox: A list of element, where only one can be selected.
  • Dropdown: A dropdown menu.
  • 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.
  • CatchEvent: Decorate a component, using on_event to catch events. This function must returns true when the event has been handled, false otherwise.
  • Maybe: Decorate a component child. It is shown only when show returns true.
  • Hoverable: Wrap a component. Gives the ability to know if it is hovered by the mouse.
  • Window: A draggeable / resizeable window. To use multiple of them, they must be stacked using Container::Stacked({...}) component;.

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::Canvas
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::FlexboxConfig
ftxui::ImageA rectangular grid of Pixel.
ftxui::LinearGradientA class representing the settings for linear-gradient color effect.
ftxui::Loop
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::SelectionRepresent a selection in the terminal.
ftxui::Table
ftxui::TableSelection