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
- Functional style. Inspired by [1] and React
- Simple and elegant syntax (in my opinion)
- Keyboard & mouse navigation.
- Support for UTF8 and fullwidth chars (→ 测试)
- Support for animations. Demo 1, Demo 2
- Support for drawing. Demo
- No dependencies
- Cross platform: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
- Learn by examples, and tutorials
- Multiple packages: CMake FetchContent (preferred), vcpkg, pkgbuild, conan.
- Good practises: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
Documentation
Operating systems
This is expected to be cross platform. This supports / tests:
- WebAssembly
- Linux
- MacOS
- Windows
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:
- horizontally with
hbox
- vertically with
vbox
- inside a grid with
gridbox
- wrap along one direction using the
flexbox
.
Element can become flexible using the the flex
decorator.
Example using hbox
, vbox
and filler
.
Example using gridbox:
Example using flexbox:
An element can be decorated using the functions:
bold
dim
inverted
underlined
blink
color
bgcolor
FTXUI supports the pipe operator. It means: decorator1(decorator2(element))
and element | decorator1 | decorator2
can be used.
FTXUI support every color palette:
Color gallery:
Use decorator border and element separator() to subdivide your UI:
auto document = vbox({
text("top"),
separator(),
text("bottom"),
}) | border;
Demo:
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);
A class to easily style a table of data.
Drawing can be made on a Canvas, using braille, block, or simple characters:
Simple example:
Complex examples:
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)
Project using FTXUI
Feel free to add your projects here:
- json-tui
- git-tui
- rgb-tui
- chrome-log-beautifier
- x86-64 CPU Architecture Simulation
- ltuiny
- i3-termdialogs
- Just-Fast
- simpPRU
- Pigeon ROS TUI
- hastur
- CryptoCalculator
- todoman
- TimeAccumulator
- vantage
- tabdeeli
- tiles
- cachyos-cli-installer
cpp-best-practices/game_jam
Several games using the FTXUI have been made during the Game Jam:
- TermBreaker [Play web version]
- Minesweeper Marathon [Play web version]
- Grand Rounds
- LightsRound
- DanteO
- Sumo
- Drag Me aROUND
- DisarmSelfDestruct
- TheWorld
- smoothlife
- Consu
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 v2.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 | 3.0.0+2 |
---|---|
license | MIT |
repository | https://pkg.cppget.org/1/stable |
download | libftxui-3.0.0+2.tar.gz |
sha256 | b642d9f9cf2fe5848668e5b04222eebcd7afe444d4ab19ebff6ea23b8c789b77 |
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 == 3.0.0 |
Examples
libftxui-examples == 3.0.0 |
Builds
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_15.0-static_O3 |
timestamp | 2024-05-12 13:50:16 UTC (19:55:48 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_15.0-O3 |
timestamp | 2024-05-12 13:49:35 UTC (19:56:29 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_15.0 |
timestamp | 2024-05-12 13:48:58 UTC (19:57:06 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-gcc_13_homebrew |
timestamp | 2024-05-12 11:44:01 UTC (22:02:03 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_16.0_libc++ |
timestamp | 2024-05-12 11:37:18 UTC (22:08:46 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_16.0_libc++-static_O3 |
timestamp | 2024-05-12 11:37:00 UTC (22:09:04 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_16.0-static_O3 |
timestamp | 2024-05-12 11:36:57 UTC (22:09:07 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_16.0_libc++-O3 |
timestamp | 2024-05-12 11:36:51 UTC (22:09:13 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_16.0-O3 |
timestamp | 2024-05-12 11:36:35 UTC (22:09:29 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_16.0 |
timestamp | 2024-05-12 11:36:22 UTC (22:09:42 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-gcc_13_homebrew-O3 |
timestamp | 2024-05-12 11:30:03 UTC (22:16:01 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-gcc_13_homebrew-static_O3 |
timestamp | 2024-05-12 11:28:46 UTC (22:17:17 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-clang_16.0_llvm_msvc_17.6-static_O2 |
timestamp | 2024-05-12 11:27:35 UTC (22:18:29 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-clang_16.0_llvm_msvc_17.6 |
timestamp | 2024-05-12 11:27:13 UTC (22:18:51 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-w64-mingw32 |
tgt config | windows_10-gcc_12.2_mingw_w64-static_O2 |
timestamp | 2024-05-12 11:13:30 UTC (22:32:34 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_fedora_37-gcc_12.2-bindist |
timestamp | 2024-05-12 11:12:26 UTC (22:33:37 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-freebsd13.2 |
tgt config | freebsd_13-clang_14.0-static_O3 |
timestamp | 2024-05-12 11:11:40 UTC (22:34:24 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-freebsd13.2 |
tgt config | freebsd_13-clang_14.0-O3 |
timestamp | 2024-05-12 11:11:33 UTC (22:34:31 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-freebsd13.2 |
tgt config | freebsd_13-clang_14.0 |
timestamp | 2024-05-12 11:11:13 UTC (22:34:51 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_15.0 |
timestamp | 2024-05-12 11:10:38 UTC (22:35:26 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-msvc_17.6-O2 |
timestamp | 2024-05-12 11:10:28 UTC (22:35:36 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-msvc_17.6 |
timestamp | 2024-05-12 11:10:20 UTC (22:35:44 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_fedora_38-gcc_13-bindist |
timestamp | 2024-05-12 11:09:49 UTC (22:36:15 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-gcc_13.1-static_O3 |
timestamp | 2024-05-12 11:09:38 UTC (22:36:26 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-gcc_13.1 |
timestamp | 2024-05-12 11:09:36 UTC (22:36:28 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-msvc_17.5 |
timestamp | 2024-05-12 11:07:36 UTC (22:38:28 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-gcc_13.1-O3 |
timestamp | 2024-05-12 11:05:26 UTC (22:40:38 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-gcc_12-bindist |
timestamp | 2024-05-12 11:05:10 UTC (22:40:54 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-freebsd12.4 |
tgt config | freebsd_12-clang_13.0 |
timestamp | 2024-05-12 11:04:24 UTC (22:41:40 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-clang_16.0_llvm_msvc_17.6-O2 |
timestamp | 2024-05-12 11:03:26 UTC (22:42:38 hours ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_11-gcc_12.1 |
timestamp | 2024-05-12 11:01:57 UTC (22:44:07 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-w64-mingw32 |
tgt config | windows_10-gcc_12.2_mingw_w64 |
timestamp | 2024-05-12 10:34:17 UTC (23:11:47 hours ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-w64-mingw32 |
tgt config | windows_10-gcc_12.2_mingw_w64-O2 |
timestamp | 2024-05-12 10:34:05 UTC (23:11:59 hours ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-clang_15.0_msvc_msvc_17.6 |
timestamp | 2024-05-12 10:30:58 UTC (23:15:05 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-msvc_17.6-static_O2 |
timestamp | 2024-05-12 10:30:58 UTC (23:15:06 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-gcc_13.1-ndebug_O3 |
timestamp | 2024-05-12 10:30:18 UTC (23:15:46 hours ago) |
result | warning (update) | warning (test) | error (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_15 |
timestamp | 2024-05-12 10:30:14 UTC (23:15:50 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_11-gcc_12 |
timestamp | 2024-05-12 10:25:53 UTC (23:20:11 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16_libc++ |
timestamp | 2024-05-11 11:52:47 UTC (01 21:53:17 days ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16-static_O3 |
timestamp | 2024-05-11 11:38:08 UTC (01 22:07:56 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16_libc++-O3 |
timestamp | 2024-05-11 11:35:50 UTC (01 22:10:14 days ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16-O3 |
timestamp | 2024-05-11 11:34:38 UTC (01 22:11:26 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16_libc++-static_O3 |
timestamp | 2024-05-11 11:31:07 UTC (01 22:14:57 days ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16 |
timestamp | 2024-05-11 11:27:59 UTC (01 22:18:04 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_14.0 |
timestamp | 2024-05-10 12:14:13 UTC (02 21:31:51 days ago) |
result | error (update) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_14.0-static_O3 |
timestamp | 2024-05-10 11:41:19 UTC (02 22:04:45 days ago) |
result | error (update) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_14.0-O3 |
timestamp | 2024-05-10 11:40:25 UTC (02 22:05:39 days ago) |
result | error (update) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13-O3 |
timestamp | 2024-05-10 11:35:34 UTC (02 22:10:30 days ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13-ndebug_O3 |
timestamp | 2024-05-10 11:23:20 UTC (02 22:22:44 days ago) |
result | warning (update) | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13 |
timestamp | 2024-05-10 11:06:35 UTC (02 22:39:29 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13-static_O3 |
timestamp | 2024-05-10 11:04:51 UTC (02 22:41:13 days ago) |
result | warning (update) | error (test) | log | rebuild |
target | x86_64-linux-gnu |
---|---|
tgt config | linux_debian_12-clang_15.0_libc++ |
result | excluded (hangs the compiler) |
target | aarch64-linux-gnu |
---|---|
tgt config | linux_debian_12-clang_15_libc++ |
result | excluded (hangs the compiler) |