Skip to content
You are viewing documentation for v7.0.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::Surface: Base 2D grid of Cells (formerly Image).
  • ftxui::Cell: A single Unicode grapheme and its foreground/background style (formerly Pixel).
  • 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.
  • flexbox (variants: hflow, vflow): A container displaying elements on row/columns and capable of wrapping on the next column/row when full.
  • gridbox: A container displaying a grid of elements.
  • filler: An element that will 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 ​

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.
  • Collapsible: A collapsible component. It displays a checkbox with an arrow. Once activated, the child is displayed.
  • 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;.

Animation ​

Other ​

Core Classes ​

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

ClassDescription
ftxui::AppApp is a class that manages the application lifecycle. It is responsible for initializing the terminal, running the main loop, and cleaning up on exit.
ftxui::BoxBox is a structure that represents a rectangular area in a 2D space.
ftxui::CanvasCanvas is a drawable buffer associated with drawing operations.
ftxui::CellA Unicode character and its associated style.
ftxui::ColorColor is a class that represents a color in the terminal user interface.
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::FlexboxConfigFlexboxConfig is a configuration structure that defines the layout properties for a flexbox container.
ftxui::LinearGradientA class representing the settings for linear-gradient color effect.
ftxui::LoopLoop is a class that manages the event loop for a component.
ftxui::MouseA mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift, ctrl, meta).
ftxui::NodeNode is the base class for all elements in the DOM tree.
ftxui::RequirementRequirement is a structure that defines the layout requirements for a Node in the terminal user interface.
ftxui::ScreenA rectangular grid of Cell.
ftxui::SelectionRepresents a selection in a terminal user interface.
ftxui::SurfaceA rectangular grid of Cell.
ftxui::TableTable is a utility to draw tables.
ftxui::TableSelection