ratatui_ruby

 builds.sr.ht status  License  Gem Total Downloads  Gem Version  Ratatui Version image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iaWNvbiBpY29uLXRhYmxlciBpY29ucy10YWJsZXItb3V0bGluZSBpY29uLXRhYmxlci1tYWlsIj48cGF0aCBzdHJva2U9Im5vbmUiIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMyA3YTIgMiAwIDAgMSAyIC0yaDE0YTIgMiAwIDAgMSAyIDJ2MTBhMiAyIDAgMCAxIC0yIDJoLTE0YTIgMiAwIDAgMSAtMiAtMnYtMTB6IiAvPjxwYXRoIGQ9Ik0zIDdsOSA2bDkgLTYiIC8+PC9zdmc+Cg==: Mailing List: Discussion image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iaWNvbiBpY29uLXRhYmxlciBpY29ucy10YWJsZXItb3V0bGluZSBpY29uLXRhYmxlci1tYWlsIj48cGF0aCBzdHJva2U9Im5vbmUiIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMyA3YTIgMiAwIDAgMSAyIC0yaDE0YTIgMiAwIDAgMSAyIDJ2MTBhMiAyIDAgMCAxIC0yIDJoLTE0YTIgMiAwIDAgMSAtMiAtMnYtMTB6IiAvPjxwYXRoIGQ9Ik0zIDdsOSA2bDkgLTYiIC8+PC9zdmc+Cg==: Mailing List: Development image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iaWNvbiBpY29uLXRhYmxlciBpY29ucy10YWJsZXItb3V0bGluZSBpY29uLXRhYmxlci1tYWlsIj48cGF0aCBzdHJva2U9Im5vbmUiIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMyA3YTIgMiAwIDAgMSAyIC0yaDE0YTIgMiAwIDAgMSAyIDJ2MTBhMiAyIDAgMCAxIC0yIDJoLTE0YTIgMiAwIDAgMSAtMiAtMnYtMTB6IiAvPjxwYXRoIGQ9Ik0zIDdsOSA2bDkgLTYiIC8+PC9zdmc+Cg==: Mailing List: Announcements

Introduction

ratatui_ruby is a Ruby wrapper for Ratatui. It allows you to cook up Terminal User Interfaces in Ruby. ratatui_ruby is a community wrapper that is not affiliated with the Ratatui team.

{Why RatatuiRuby?}[./doc/getting_started/why.md] — Native Rust performance, zero runtime overhead, and Ruby’s expressiveness. See how we compare to CharmRuby, raw Rust, and Go.

Please join the announce mailing list at lists.sr.ht/~kerrick/ratatui_ruby-announce to stay up-to-date on new releases and announcements. See the trunk branch for pre-release updates.


The Ecosystem

RatatuiRuby: Core engineTea: MVU architectureKit: Component architecture (Planned) • DSL: Glimmer syntax (Planned) • Framework: Omakase framework (Planned) • UI: Polished widgets (Planned) • UI Pro: More polished widgets (Planned)

For App Developers

Get Started: QuickstartExamplesStay Informed: Announce ListFAQReach Out: Discuss ListBug Tracker

For Contributors

Get Started: Contributing GuideCode of ConductStay Informed: Announce ListProject HistoryReach Out: Development ListBug Tracker


Compatibility

ratatui_ruby is designed to run on everything Ruby does, including:

We support the latest minor version of every non-eol Ruby version, including Ruby 4.

Installation

Add this line to your application’s Gemfile:

gem "ratatui_ruby"

And then execute:

bundle install

Or install it yourself with:

gem install ratatui_ruby

Usage

ratatui_ruby uses an immediate-mode API. You describe your UI using Ruby objects and call draw in a loop.

RatatuiRuby.run do |tui|
  loop do
    tui.draw do |frame|
      frame.render_widget(
        tui.paragraph(
          text: "Hello, Ratatui! Press 'q' to quit.",
          alignment: :center,
          block: tui.block(
            title: "My Ruby TUI App",
            borders: [:all],
            border_style: { fg: "cyan" }
          )
        ),
        frame.area
      )
    end
    case tui.poll_event
    in { type: :key, code: "q" } | { type: :key, code: "c", modifiers: ["ctrl"] }
      break
    else
      nil
    end
  end
end

Hello Ratatui

For a full tutorial, see the Quickstart. For an explanation of the application architecture, see Application Architecture.

Features

ratatui_ruby gives you 20+ widgets out of the box:

Category Widgets
Data Display Table, List, Chart, Bar Chart, Sparkline, Calendar
Layout Block, Tabs, Scrollbar, Center, Overlay, Clear
Input Gauge, Line Gauge
Text Paragraph, Rich Text (Spans + Lines), Cursor
Canvas Shapes (Line, Circle, Rectangle, Map), Custom Drawing

Plus: flexible layouts with constraints, full keyboard/mouse/paste/resize events, snapshot testing, and hex/RGB/256-color support.

Documentation

Resource Description
Quickstart Get running in 5 minutes
Widget Gallery Every widget with examples
Application Architecture Patterns for scaling your app
API Reference Full RDoc documentation
Wiki Guides and community resources

Contributing

Bug reports and pull requests are welcome on sourcehut at sr.ht/~kerrick/ratatui_ruby/. This project is intended to be a safe, productive collaboration, and contributors are expected to adhere to the Code of Conduct.

Issues for the underlying Rust library should be filed at ratatui/ratatui.

Want to help develop ratatui_ruby? Check out the contribution guide on the wiki.

Note: Active development happens on the trunk branch. Use trunk if you are a contributor or want the latest cutting-edge features. stable is for stable releases only.

Copyright & License

ratatui_ruby is copyright 2025, Kerrick Long.

The library is LGPL-3.0-or-later: you can use it in proprietary applications, but you must share changes you make to ratatui_ruby itself. Documentation snippets and widget examples are MIT-0: copy and use them without attribution.

Documentation is CC-BY-SA-4.0. Build tooling and full app examples are AGPL-3.0-or-later. See each file’s SPDX comment for specifics.

Some parts of this program are copied from other sources under appropriate reuse licenses, and the copyright belongs to their respective owners. See the REUSE Specification – Version 3.3 for details.

This program was created with significant assistance from multiple LLMs. The process was human-controlled through creative prompts, with human contributions to each commit. See commit footers for model attribution. declare-ai.org