Skip to content

Introduction

Demo

Ratatui is a Rust library for cooking up delicious text user interfaces (TUIs). It is a lightweight library that provides a set of widgets and utilities to build simple or complex rust TUIs.

Ratatui is an immediate mode graphics library. Applications imperatively declare how to render each frame in full by combining widgets and layout. Ratatui then draws the described UI widgets efficiently to the terminal.

Applications built with Ratatui use the features of their chosen backend (Crossterm, Termion, or Termwiz to handle:

  • keyboard input events
  • mouse events
  • switching to raw mode and the alternate screen

Ratatui is very flexible and customizable. It does not dictate how you need to structure your application, as it is a library not a framework. This book covers some different options covering the range from simple single file applications through more complex applications using approaches based on components, Flux and The Elm Architecture.

Who is ratatui for?

Ratatui is designed for developers and enthusiasts who:

  • want a lightweight alternative to graphical user interfaces (GUIs)
  • need applications that are to be deployed in constrained environments (e.g. on servers with limited resources)
  • prefer to have full control over input and events, allowing for a more customized and tailored user experience
  • appreciate the retro aesthetic of the terminal

Who is this book for?

In this book, we will cover beginner guides to advanced patterns for developing terminal user interfaces.

Those new to the world of TUIs will find this book a comprehensive guide, introducing the foundational concepts and walking through common patterns of using Ratatui. Additionally, developers who have worked with TUIs will understand the nuances and benefits of using Ratatui.

We hope that this book can be a journey into creating beautiful and functional terminal-based applications.