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
underlinedDouble
blink
strikethrough
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
- beagle-config
- turing_cmd
- StartUp
- eCAL monitor
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 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://pkg.cppget.org/1/stable |
download | libftxui-4.0.0.tar.gz |
sha256 | e9907765d606538a19c2aac325e6ead1977afec448f3954f8125cea5e407b53d |
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.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-gcc_13_homebrew-static_O3 |
timestamp | 2024-04-27 12:20:11 UTC (11:08:59 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-04-27 12:19:30 UTC (11:09:40 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 |
timestamp | 2024-04-27 12:18:40 UTC (11:10:30 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-static_O2 |
timestamp | 2024-04-27 12:06:15 UTC (11:22:55 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-O2 |
timestamp | 2024-04-27 12:04:01 UTC (11:25:09 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-04-27 12:02:54 UTC (11:26:16 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++-O3 |
timestamp | 2024-04-27 12:02:07 UTC (11:27:02 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-04-27 11:57:15 UTC (11:31:55 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++-static_O3 |
timestamp | 2024-04-27 11:55:58 UTC (11:33:12 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-O3 |
timestamp | 2024-04-27 11:54:49 UTC (11:34:20 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-static_O3 |
timestamp | 2024-04-27 11:52:44 UTC (11:36:26 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-O3 |
timestamp | 2024-04-27 11:52:36 UTC (11:36:33 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-04-27 11:52:12 UTC (11:36:58 hours ago) |
result | 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-04-27 11:51:00 UTC (11:38:10 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-static_O2 |
timestamp | 2024-04-27 11:39:28 UTC (11:49:42 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-ndebug_O3 |
timestamp | 2024-04-27 11:35:08 UTC (11:54:02 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-04-27 11:32:42 UTC (11:56:28 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 |
timestamp | 2024-04-27 11:32:28 UTC (11:56:41 hours ago) |
result | 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-04-27 11:30:14 UTC (11:58:56 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_15.0_msvc_msvc_17.6 |
timestamp | 2024-04-27 11:29:21 UTC (11:59:49 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-04-27 11:26:37 UTC (12:02:33 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-04-27 11:25:41 UTC (12:03:29 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-static_O2 |
timestamp | 2024-04-27 11:25:40 UTC (12:03:30 hours ago) |
result | warning (update) | 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-04-27 11:24:51 UTC (12:04:18 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-04-27 11:24:30 UTC (12:04:40 hours ago) |
result | warning (update) | 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-04-27 11:24:10 UTC (12:05:00 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16_libc++-O3 |
timestamp | 2024-04-27 11:23:38 UTC (12:05:32 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-04-27 11:23:14 UTC (12:05:56 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16-O3 |
timestamp | 2024-04-27 11:22:07 UTC (12:07:02 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-msvc_17.6 |
timestamp | 2024-04-27 11:21:55 UTC (12:07:14 hours ago) |
result | warning (update) | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16-static_O3 |
timestamp | 2024-04-27 11:20:53 UTC (12:08:16 hours 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-04-27 11:20:52 UTC (12:08:18 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-linux-gnu |
tgt config | linux_debian_12-clang_15.0_libc++ |
timestamp | 2024-04-27 11:20:26 UTC (12:08:43 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-04-27 11:19:17 UTC (12:09:52 hours ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_16 |
timestamp | 2024-04-27 11:18:18 UTC (12:10:52 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-microsoft-win32-msvc14.3 |
tgt config | windows_10-msvc_17.5 |
timestamp | 2024-04-27 11:17:11 UTC (12:11:58 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_11-gcc_12.1 |
timestamp | 2024-04-27 11:07:17 UTC (12:21:52 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-04-27 11:06:01 UTC (12:23:09 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-O2 |
timestamp | 2024-04-27 10:47:58 UTC (12:41:12 hours ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-w64-mingw32 |
tgt config | windows_10-gcc_12.2_mingw_w64 |
timestamp | 2024-04-27 10:31:37 UTC (12:57:32 hours 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-static_O3 |
timestamp | 2024-04-26 11:51:15 UTC (01 11:37:54 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-O3 |
timestamp | 2024-04-26 11:50:08 UTC (01 11:39:02 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-04-26 11:48:44 UTC (01 11:40:25 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13-ndebug_O3 |
timestamp | 2024-04-26 11:05:09 UTC (01 12:24:01 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13-O3 |
timestamp | 2024-04-26 11:03:57 UTC (01 12:25:12 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-04-26 11:03:21 UTC (01 12:25:48 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-gcc_13 |
timestamp | 2024-04-26 11:01:08 UTC (01 12:28:02 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | x86_64-apple-darwin22.5.0 |
tgt config | macos_13-clang_15.0-static_O3 |
timestamp | 2024-04-26 08:50:19 UTC (01 14:38:51 days 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-clang_15.0-O3 |
timestamp | 2024-04-26 08:48:16 UTC (01 14:40:53 days 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-clang_15.0 |
timestamp | 2024-04-26 08:42:36 UTC (01 14:46:33 days ago) |
result | warning (test) | warning (test-installed) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_15_libc++ |
timestamp | 2024-04-25 10:34:20 UTC (02 12:54:49 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_12-clang_15 |
timestamp | 2024-04-25 10:30:33 UTC (02 12:58:37 days ago) |
result | error (test) | log | rebuild |
toolchain | public-0.16.0 |
---|---|
target | aarch64-linux-gnu |
tgt config | linux_debian_11-gcc_12 |
timestamp | 2024-04-25 10:28:46 UTC (02 13:00:23 days ago) |
result | error (test) | log | rebuild |