Skip to content
Zaniah

A pure Ruby UI toolkit

Ruby draws the whole window.

Build desktop and terminal interfaces through native GPU APIs, a deterministic headless renderer, or ANSI output. No extension compilation. No rendering subprocess.

Zaniah::Window 480 × 240
window.draw do
  Zaniah::Div.new
    .flex_col
    .p(24)
    .gap(12)
    .child(title)
    .child(body)
end
headless.png

Hello, Ruby.

The interface is Ruby, all the way down.

Supported surfaces

One toolkit. Every surface it needs.

Zaniah keeps layout, state, text, input, and rendering in one Ruby process while adapting to the surface beneath it.

Native by default
Open real platform windows and render through Metal, OpenGL, EGL, or WGL using Ruby’s Fiddle.
Test what you draw
The pure Ruby headless backend produces deterministic frames and PNG output without a display server.
Layout at scale
Compose flex, constraint, absolute, wrapping, and baseline-aware layouts with virtual lists for large data sets.
Real application input
Handle keyboard, pointer, IME, clipboard, file-drop, display, and filesystem events through one API.
hello.rb Ruby 3.1+
require "zaniah"

window = Zaniah::Platform.open_window(
  backend: :headless,
  width: 480,
  height: 240
)
window.text_system = Zaniah::TextSystem::Renderer.new
window.draw do
  Zaniah::Div.new.flex_col.p(24).gap(12)
    .child(Zaniah::Text.new("Hello, Ruby", size: 24))
end
window.tick
window.write_png("hello.png")
window.close

Start with one gem.

Add Zaniah, choose a backend, and draw. Switch from headless output to a native window without rewriting the interface.

gem "zaniah"