GitHub - jonoton/cpp-tui: A lightweight, single-header C++ TUI (Text User Interface) library · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
jonoton
cpp-tui
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star<br>42
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>21 Commits<br>21 Commits
.devcontainer
.devcontainer
docs
docs
examples
examples
.clang-format
.clang-format
.gitignore
.gitignore
CMakeLists.txt
CMakeLists.txt
LICENSE
LICENSE
README.md
README.md
cpptui.hpp
cpptui.hpp
View all files
Repository files navigation
cpp-tui
A lightweight, single-header C++ TUI (Text User Interface) library.
Features
Single Header : Easy integration with just #include "cpptui.hpp".
Modern C++ : Designed for C++17.
Cross-Platform : Works on Windows/POSIX.
Theme System :
Built-in Themes : Theme::Dark() (Catppuccin Mocha), Theme::Light() (Catppuccin Latte), Theme::Nord(), Theme::TokyoNight(), Theme::SolarizedLight().
Dynamic Toggling : Switch themes at runtime with Theme::set_theme().
Semantic Colors : Widgets use abstract names (primary, background, error) for automatic styling.
Global Background : Application window automatically fills with the theme's background color.
Advanced Event System :
Keyboard : Full support for arrow keys, function keys, modifiers (Shift/Ctrl/Alt). Global key bindings via register_key() with Ctrl/Alt/Shift modifier support — callbacks fire before widget-level dispatch.
Focus Management : Robust tab-key navigation (forward/reverse via Shift+Tab), click-to-focus support, and safe handling of nested/hidden widgets.
Mouse : Full tracking support including click, drag, scroll wheel, and hover.
Resize : Automatic layout updates on window resize (SIGWINCH).
Cross-Thread Updates : Thread-safe update() and post() methods to trigger redraws or schedule work from background threads.
Rich Widget Library :
Core : Label, Paragraph, Button, Input (with Regex & Placeholders), TextArea (Multiline Editor), Checkbox, ProgressBar, Sparkline, Spinner, Border.
Advanced Inputs :
ToggleSwitch: Boolean toggle with custom on/off labels.
NumberInput: Integer input with stepper buttons (+/-) and validation.
RadioSet: Exclusive selection from a group of options.
CheckboxList: Manage multiple boolean options in a list.
ColorPicker: HSV/RGB color selection widget with gradient and hex input.
Dropdown: Collapsible selection menu.
Lists & Tables :
TablePaginated: Classic data table with automated pagination and footer controls.
TableScrollable: Efficient, infinite-scroll list with keyboard/mouse navigation (row selection, scrollbar, wheel support).
TreeView: Hierarchical tree structure.
TextList: Formatted lists with bullets or numbering and text selection.
Containers : Tabs (tabbed interface with overflow navigation), Carousel (slide-show), Stack (z-ordering), ScrollableVertical, ScrollableHorizontal, ScrollableContainer (2D panning), Dialog, FileExplorer (File system browser).
Charting :
LineChart: Multi-series line graphs (Points, Lines, Braille styles supported) with interactive tooltips.
ScatterChart: Plot points with custom markers and interactive tooltips.
BarChart: Vertical bar graphs with support for axes, ticks, and interactive tooltips.
Menus : Popup menu system with keyboard/mouse support.
Layouts :
Containers : Vertical, Horizontal, Grid, and Align.
VerticalSpacer(int height): Add fixed or flexible vertical space.
HorizontalSpacer(int width): Add fixed or flexible horizontal space.
Dynamic Flex Allocation : Layouts divide remaining available space among non-fixed widgets (supported in Vertical, Horizontal, ScrollableVertical, and ScrollableHorizontal), applying a multi-pass clamping algorithm to satisfy min_*/max_* constraints.
Min/Max Constraints : Global min_width, max_width, min_height, and max_height properties are respected by layout containers during space negotiation and cross-axis alignment, with min overriding max (min-wins precedence).
Auto-Shrink : Containers can automatically shrink to...