libftxui/4.0.0

[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.0.0
license MIT
repository https://github.com/wroyca/FTXUI.git#master@90be26b0c209e2995eaf94efbcbe81199eaacdfc
fragment 90be26b0c209e2995eaf94efbcbe81199eaacdfc
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.0.0

Examples

libftxui-examples == 4.0.0

Builds

toolchain public-0.15.0
config macos_12-gcc_12.1_homebrew-static_O3 / x86_64-apple-darwin21.6.0
timestamp 2023-05-19 16:20:19 UTC (18 11:08:46 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config macos_12-gcc_12.1_homebrew-O3 / x86_64-apple-darwin21.6.0
timestamp 2023-05-19 16:15:34 UTC (18 11:13:30 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config macos_12-gcc_12.1_homebrew / x86_64-apple-darwin21.6.0
timestamp 2023-05-19 16:12:05 UTC (18 11:16:59 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config macos_12-clang_13.1-static_O3 / x86_64-apple-darwin21.6.0
timestamp 2023-05-19 16:05:53 UTC (18 11:23:11 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config macos_12-clang_13.1-O3 / x86_64-apple-darwin21.6.0
timestamp 2023-05-19 16:03:57 UTC (18 11:25:07 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config macos_12-clang_13.1 / x86_64-apple-darwin21.6.0
timestamp 2023-05-19 15:55:22 UTC (18 11:33:42 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-msvc_17.2-static_O2 / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:54:01 UTC (18 11:35:04 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_14.0_llvm_msvc_17.2-static_O2 / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:53:18 UTC (18 11:35:46 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-msvc_16.11-static_O2 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:53:09 UTC (18 11:35:56 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_13.0_llvm_msvc_16.11_lld / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:53:08 UTC (18 11:35:56 days ago)
result warning (update) | warning (test) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_14.0_llvm_msvc_17.2_lld / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:53:00 UTC (18 11:36:04 days ago)
result warning (update) | warning (test) | log | rebuild
toolchain public-0.15.0
config windows_10-msvc_17.2-O2 / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:52:37 UTC (18 11:36:28 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_13.0_llvm_msvc_16.11-static_O2 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:52:17 UTC (18 11:36:47 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-gcc_11.2_mingw_w64-static_O2 / x86_64-w64-mingw32
timestamp 2023-05-19 15:51:55 UTC (18 11:37:10 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config macos_11-clang_13.0 / x86_64-apple-darwin20.5.0
timestamp 2023-05-19 15:51:53 UTC (18 11:37:11 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10_devmode-msvc_16.11 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:51:50 UTC (18 11:37:14 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-msvc_17.2 / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:51:40 UTC (18 11:37:24 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-msvc_16.11-O2 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:51:07 UTC (18 11:37:58 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_14.0_libc++-static_O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:50:30 UTC (18 11:38:34 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_14.0_libc++-O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:50:09 UTC (18 11:38:55 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_14.0_llvm_msvc_17.2-O2 / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:50:09 UTC (18 11:38:56 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-msvc_16.11 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:49:55 UTC (18 11:39:10 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_14.0_llvm_msvc_17.2 / x86_64-microsoft-win32-msvc14.3
timestamp 2023-05-19 15:49:52 UTC (18 11:39:12 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_13.0_llvm_msvc_16.11-O2 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:49:45 UTC (18 11:39:20 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-gcc_12.1-static_O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:48:52 UTC (18 11:40:13 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-clang_13.0_llvm_msvc_16.11 / x86_64-microsoft-win32-msvc14.2
timestamp 2023-05-19 15:48:47 UTC (18 11:40:17 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-gcc_11.2_mingw_w64-O2 / x86_64-w64-mingw32
timestamp 2023-05-19 15:48:41 UTC (18 11:40:23 days ago)
result error (test) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_14.0_libc++ / x86_64-linux-gnu
timestamp 2023-05-19 15:48:40 UTC (18 11:40:24 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config windows_10-gcc_11.2_mingw_w64 / x86_64-w64-mingw32
timestamp 2023-05-19 15:48:33 UTC (18 11:40:31 days ago)
result error (test) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-gcc_12.1-ndebug_O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:48:32 UTC (18 11:40:33 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_14.0-static_O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:48:14 UTC (18 11:40:50 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config freebsd_13-clang_13.0-static_O3 / x86_64-freebsd13.1
timestamp 2023-05-19 15:47:30 UTC (18 11:41:34 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-gcc_12.1-O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:46:42 UTC (18 11:42:22 days ago)
result warning (update) | warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_14.0-O3 / x86_64-linux-gnu
timestamp 2023-05-19 15:46:37 UTC (18 11:42:27 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-gcc_12.1 / x86_64-linux-gnu
timestamp 2023-05-19 15:46:22 UTC (18 11:42:43 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config freebsd_13-clang_13.0-O3 / x86_64-freebsd13.1
timestamp 2023-05-19 15:46:21 UTC (18 11:42:44 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_13.0_libc++ / x86_64-linux-gnu
timestamp 2023-05-19 15:46:19 UTC (18 11:42:46 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_14.0 / x86_64-linux-gnu
timestamp 2023-05-19 15:46:17 UTC (18 11:42:47 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-gcc_11.3 / x86_64-linux-gnu
timestamp 2023-05-19 15:46:16 UTC (18 11:42:49 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-clang_13.0 / x86_64-linux-gnu
timestamp 2023-05-19 15:46:14 UTC (18 11:42:50 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config linux_debian_11-emcc_3.1.6 / wasm32-emscripten
timestamp 2023-05-19 15:46:02 UTC (18 11:43:02 days ago)
result error (test) | log | rebuild
toolchain public-0.15.0
config freebsd_13-clang_13.0 / x86_64-freebsd13.1
timestamp 2023-05-19 15:45:43 UTC (18 11:43:22 days ago)
result warning (test) | warning (test-installed) | log | rebuild
toolchain public-0.15.0
config freebsd_12-clang_10.0 / x86_64-freebsd12.3
timestamp 2023-05-19 15:45:38 UTC (18 11:43:27 days ago)
result warning (test) | warning (test-installed) | log | rebuild