Jag
GPU-accelerated 2D rendering and UI toolkit for Rust.
Build interactive UIs with composable elements, GPU-powered rendering via wgpu, and automatic flex/grid layout via Taffy.

Crates
| Crate | Description |
|---|---|
jag |
Meta-crate re-exporting jag-draw, jag-ui, and jag-surface |
jag-draw |
Low-level GPU 2D renderer (display list, painter, pass manager) |
jag-ui |
UI elements, widgets, events, focus, and Taffy-based layout |
jag-surface |
Canvas-style drawing API on top of jag-draw |
Quick Start
[]
= "0.1"
= "0.30"
= "0.3"
use ;
use JagSurface;
use ;
use Theme;
// Create elements
let theme = default;
let mut btn = with_theme;
btn.rect = Rect ;
// Render to a canvas
btn.render;
Features
- GPU-accelerated rendering — wgpu backend with display list batching
- 19 UI elements — Button, InputBox, TextArea, Checkbox, Radio, Select, ToggleSwitch, Slider, DatePicker, Link, Container, Card, Modal, Alert, Badge, Table, Image, Text
- Widgets — TextInput, TabBar, PopupMenu with built-in state management
- Event handling — Mouse, keyboard, and scroll events with hit testing
- Focus management — Tab navigation with configurable tab indices
- Theming — Dark/Light modes with customizable colors
- Layout — Taffy-based flex and grid layout
- Text rendering — System font loading, shaping (harfrust), rasterization (swash), subpixel rendering
- Canvas API — Higher-level drawing with rounded rects, images, gradients, SVG, shadows
Running the Demo
Architecture
jag (meta-crate)
├── jag-draw — GPU renderer (wgpu display list pipeline)
│ ├── jag-shaders — WGSL shader modules
│ └── jag-text — Text layout and shaping engine
├── jag-surface — Canvas API (fill_rect, draw_text, images, etc.)
└── jag-ui — UI elements, widgets, events, layout
License
MIT License. See LICENSE-MIT for details.
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.