Skip to content

Oltsu-code/Vextr

Repository files navigation

CI

Vextr

Vextr is a flexible widget-based terminal UI framework for modern C++.


Features

  • Cross-platform: Windows and Unix terminals supported
  • Flexible layout system: stack, grid, absolute positioning
  • Rich styling: RGB colors, bold/underline, padding/margin
  • Common widgets: labels, buttons, inputs, scroll views
  • Simple API for building complex UIs
  • Flexibility oriented
  • Events

Installation

CMake FetchContent

include(FetchContent)

FetchContent_Declare(
    vextr
    GIT_REPOSITORY https://github.com/Oltsu-code/Vextr.git
    GIT_TAG main
)

FetchContent_MakeAvailable(vextr)

target_link_libraries(my_app PRIVATE vextr)

Quick Start

  1. Include the header:

    #include "vextr.h"
  2. Create a root Container:

    auto root = std::make_shared<vextr::core::Container>(
       std::make_shared<vextr::core::StackLayout>(vextr::core::Axis::Vertical, 1)); 
  3. Create a Label widget:

    auto label = std::make_shared<vextr::widgets::Label>("Hello, Vextr!");
  4. create a Style for the Label and apply it:

    vextr::core::Style style = {
       .fg = {54, 9, 217},
       .bold = true
    };
    label->set_style(style);
  5. Add the label to the root container:

    root->add_child(label);
  6. Create the application, set the root container, and run:

    vextr::App app;
    app.setRoot(root);
    app.run();

Building from source

  1. Clone the repository:

    git clone https://github.com/Oltsu-code/Vextr.git
    cd Vextr
  2. Build with CMake:

    mkdir build
    cd build
    cmake ..
    cmake --build .
  3. Have fun!


Documentation

You can find the online documentation here. All guides should also be available in the docs/content/ folder. The code also has doxygen comments.

This repository uses Moxygen to generate the API reference documentation from Doxygen XML.

Note: The documentation is currently a work in progress.

Building the docs site

  1. Install Moxygen
npm install -g moxygen
  1. Install dependencies
cd docs/site
npm instll
  1. Generate the API References and format the content for astro
npm run generate
  1. Start the development server
npm run dev

or build

npm run build

Roadmap


Check the currently planned roadmap here.

Contributing


Contributions are welcome! Please read CONTRIBUTING.md for details.

License

Mozilla Public License Version 2.0. See LICENSE for details.