libftxui/4.1.1

[brief]

Functional Terminal (X) User interface - A simple C++ library for terminal based user interfaces!

FTXUI

Functional Terminal (X) User interface

A simple C++ library for terminal based user interfaces!

Feature

Documentation

Operating systems

This is expected to be cross platform. This supports / tests:

Example

  vbox({
    hbox({
      text("left") | border,
      text("middle") | border | flex,
      text("right") | border,
    }),
    gauge(0.5) | border,
  });
┌────┐┌───────────────────────────────────────────────────────────────┐┌─────┐
│left││middle                                                         ││right│
└────┘└───────────────────────────────────────────────────────────────┘└─────┘
┌────────────────────────────────────────────────────────────────────────────┐
│██████████████████████████████████████                                      │
└────────────────────────────────────────────────────────────────────────────┘

Short gallery

DOM

This module defines a hierarchical set of Element. An element manages layout and can be responsive to the terminal dimensions.

They are declared in <ftxui/dom/elements.hpp>

Element can be arranged together:

Element can become flexible using the the flex decorator.

Example using hbox, vbox and filler.

image

Example using gridbox:

image

Example using flexbox:

image

See also this demo.

An element can be decorated using the functions:

Example

image

FTXUI supports the pipe operator. It means: decorator1(decorator2(element)) and element | decorator1 | decorator2 can be used.

FTXUI support every color palette:

Color gallery: image

Use decorator border and element separator() to subdivide your UI:

auto document = vbox({
    text("top"),
    separator(),
    text("bottom"),
}) | border;

Demo:

image

A simple piece of text is represented using text("content").

To support text wrapping following spaces the following functions are provided:

Element paragraph(std::string text);
Element paragraphAlignLeft(std::string text);
Element paragraphAlignRight(std::string text);
Element paragraphAlignCenter(std::string text);
Element paragraphAlignJustify(std::string text);

Paragraph example

ezgif com-gif-maker (4)

A class to easily style a table of data.

Example:

image

Drawing can be made on a Canvas, using braille, block, or simple characters:

Simple example:

image

Complex examples:

ezgif com-gif-maker (3)

Component

The ftxui/component is needed when you want to produce dynamic UI, reactive to the user's input. It defines a set of ftxui::Component. A component reacts to Events (keyboard, mouse, resize, ...) and Render Element (see previous section).

Prebuilt components are declared in <ftxui/component/component.hpp>

Gallery of multiple components. (demo)

image

Example:

image

Example:

image

Example:

image

Example:

image

Example:

image

Example:

image

Example:

ezgif com-gif-maker

Example:

youtube-video-gif (3)

Vertical:

ezgif com-gif-maker (1)

Horizontal:

ezgif com-gif-maker (2)

Project using FTXUI

Feel free to add your projects here:

cpp-best-practices/game_jam

Several games using the FTXUI have been made during the Game Jam:

External package

It is highly recommended to use CMake FetchContent to depend on FTXUI. This way you can specify which commit you would like to depend on.

include(FetchContent)

FetchContent_Declare(ftxui
  GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
  GIT_TAG v3.0.0
)

FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
  FetchContent_Populate(ftxui)
  add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

If you don't, the following packages have been created:

Contributors

version 4.1.1
license MIT
repository https://pkg.cppget.org/1/testing
download libftxui-4.1.1.tar.gz
sha256 9600b998753eda454aff913b6faad8793bdbe88dadea614c6156b2f2cdef3a93
project FTXUI
url arthursonzogni.github.io/FTXUI/
doc-url arthursonzogni.github.io/FTXUI/
src-url github.com/ArthurSonzogni/FTXUI
package-url github.com/build2-packaging/FTXUI
package-email packaging@build2.orgMailing list
topics C++

Tests

libftxui-tests == 4.1.1

Examples

libftxui-examples == 4.1.1

Reviews

fail 0
pass 1

Builds

toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14-static_O3
timestamp 2025-12-03 13:52:11 UTC (15:19:02 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14-ndebug_O3
timestamp 2025-12-03 13:51:36 UTC (15:19:37 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14-O3
timestamp 2025-12-03 13:51:01 UTC (15:20:12 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14
timestamp 2025-12-03 13:50:27 UTC (15:20:46 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-static_O3
timestamp 2025-12-03 12:21:58 UTC (16:49:15 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-O3
timestamp 2025-12-03 12:21:34 UTC (16:49:39 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18_libc++
timestamp 2025-12-03 12:21:22 UTC (16:49:51 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18-static_O3
timestamp 2025-12-03 12:20:59 UTC (16:50:14 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18
timestamp 2025-12-03 12:20:42 UTC (16:50:30 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18-O3
timestamp 2025-12-03 12:20:25 UTC (16:50:48 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14-static_O3
timestamp 2025-12-03 12:14:19 UTC (16:56:54 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14-ndebug_O3
timestamp 2025-12-03 12:14:15 UTC (16:56:57 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.8-static_O2
timestamp 2025-12-03 12:14:10 UTC (16:57:03 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_18_llvm_msvc_17.10-O2
timestamp 2025-12-03 12:13:46 UTC (16:57:27 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14-O3
timestamp 2025-12-03 12:13:40 UTC (16:57:33 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.10-O2
timestamp 2025-12-03 12:13:34 UTC (16:57:39 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.10-static_O2
timestamp 2025-12-03 12:13:18 UTC (16:57:55 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-w64-mingw32
tgt config windows_10-gcc_13.2_mingw_w64-static_O2
timestamp 2025-12-03 12:13:18 UTC (16:57:55 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_18_llvm_msvc_17.10-static_O2
timestamp 2025-12-03 12:13:17 UTC (16:57:56 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.8-O2
timestamp 2025-12-03 12:13:12 UTC (16:58:01 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_17_msvc_msvc_17.10
timestamp 2025-12-03 12:13:09 UTC (16:58:04 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.8
timestamp 2025-12-03 12:13:03 UTC (16:58:10 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.10
timestamp 2025-12-03 12:12:59 UTC (16:58:14 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_18_llvm_msvc_17.10
timestamp 2025-12-03 12:12:57 UTC (16:58:16 hours ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14
timestamp 2025-12-03 12:12:36 UTC (16:58:37 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_12-bindist
timestamp 2025-12-03 12:12:34 UTC (16:58:39 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_ubuntu_24.04-gcc_13-bindist
timestamp 2025-12-03 12:12:31 UTC (16:58:41 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd14.1
tgt config freebsd_14-clang_18
timestamp 2025-12-03 12:12:25 UTC (16:58:47 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd14.1
tgt config freebsd_14-clang_18-O3
timestamp 2025-12-03 12:12:20 UTC (16:58:52 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd13.3
tgt config freebsd_13-clang_17
timestamp 2025-12-03 12:12:16 UTC (16:58:57 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_17
timestamp 2025-12-03 12:12:13 UTC (16:59:00 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_17_libc++
timestamp 2025-12-03 12:12:02 UTC (16:59:11 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_fedora_40-gcc_14-bindist
timestamp 2025-12-03 12:11:49 UTC (16:59:23 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd14.1
tgt config freebsd_14-clang_18-static_O3
timestamp 2025-12-03 12:11:32 UTC (16:59:40 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_13.1
timestamp 2025-12-03 12:11:20 UTC (16:59:52 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-w64-mingw32
tgt config windows_10-gcc_13.2_mingw_w64-O2
timestamp 2025-12-03 10:52:51 UTC (18:18:22 hours ago)
result error (test) | log | rebuild
toolchain public-0.17.0
target x86_64-w64-mingw32
tgt config windows_10-gcc_13.2_mingw_w64
timestamp 2025-12-03 10:52:38 UTC (18:18:34 hours ago)
result error (test) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_17_libc++
timestamp 2025-12-03 10:25:07 UTC (18:46:06 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_17
timestamp 2025-12-03 10:24:33 UTC (18:46:40 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_13
timestamp 2025-12-03 10:24:12 UTC (18:47:01 hours ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18-O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18-static_O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18_libc++
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-static_O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_fedora_39-gcc_13-bindist
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin22.5.0
tgt config macos_13-clang_15.0
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-clang_15.0
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-clang_15.0-O3
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-clang_15.0-static_O3
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-gcc_14_homebrew
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-gcc_14_homebrew-O3
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-gcc_14_homebrew-static_O3
result unbuilt