FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
examples/dom/text.cpp
Go to the documentation of this file.
1// Copyright 2026 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#include <iostream> // for cout, endl
5#include <memory> // for shared_ptr
6#include <string> // for string, operator+
7
8#include "ftxui/dom/elements.hpp" // for text, Element, border, center
9#include "ftxui/screen/screen.hpp" // for Screen
10
11int main() {
12 using namespace ftxui;
13
14 // The `text()` element now supports newlines `\n`.
15 // It will be rendered on multiple lines.
16 auto document = text(
17 "FTXUI is a C++ library for terminal-based user interfaces.\n"
18 "It is functional, responsive, and cross-platform.\n"
19 "You can now use newlines directly within a single text() element,\n"
20 "making it easier to display multi-line strings without needing\n"
21 "to manually split them into a vbox() of multiple text() elements.") |
22 border | center;
23
24 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
25 Render(screen, document);
26 std::cout << screen.ToString() << std::endl;
27
28 return 0;
29}
The FTXUI ftxui:: namespace.
Definition animation.hpp:10