gpui

Build desktop apps with GPUI, the GPU-accelerated UI framework from Zed. Covers Entity state, Render trait, div() Tailwind API, actions/keybindings, gpui-component widgets, theming. Use when building Rust desktop applications with GPUI or gpui-component.

⭐3stars🔀1forks📁View on GitHub🕐Updated Jan 9, 2026⬇️1downloads

When & Why to Use This Skill

This Claude skill empowers developers to build high-performance, GPU-accelerated desktop applications using the GPUI framework in Rust. It provides comprehensive guidance on the hybrid immediate/retained mode architecture, state management via Entities, and modern UI construction using a Tailwind-inspired API. By leveraging this skill, developers can efficiently implement complex features like keyboard bindings, custom theming, and reactive UI components while following Zed's best practices.

Use Cases

  • Developing high-performance, cross-platform desktop applications in Rust that require GPU acceleration for smooth UI rendering.
  • Implementing complex application state management using the Entity-View model and reactive updates with cx.notify().
  • Building modern user interfaces using the div() Tailwind-like API and gpui-component widgets like Tables, Inputs, and Buttons.
  • Configuring advanced keyboard shortcuts and action bindings for professional-grade software tools.
  • Migrating web-based UI mental models (like React) to high-performance native Rust desktop development.
namegpui
descriptionBuild desktop apps with GPUI, the GPU-accelerated UI framework from Zed. Covers Entity state, Render trait, div() Tailwind API, actions/keybindings, gpui-component widgets, theming. Use when building Rust desktop applications with GPUI or gpui-component.

GPUI Development

GPUI is a hybrid immediate/retained mode, GPU-accelerated UI framework for Rust from Zed.

Quick Reference

Topic When to Use Reference
Fundamentals Starting new projects, understanding architecture fundamentals.md
State Management Entity, notify(), emit(), subscribe() state-management.md
Rendering div() API, layout, conditional rendering rendering.md
Actions Keyboard shortcuts, key bindings actions.md
Components gpui-component widgets (Button, Input, Table) components.md
Theming Colors, cx.theme(), Root view theming.md
Anti-patterns Common mistakes to avoid anti-patterns.md

Critical Setup (MUST DO)

use gpui::{Application, App};
use gpui_component::Root;

fn main() {
    Application::new().run(|cx: &mut App| {
        gpui_component::init(cx);  // REQUIRED when using gpui-component
        
        cx.open_window(opts, |window, cx| {
            let view = cx.new(|cx| MyView::new(window, cx));
            cx.new(|cx| Root::new(view, window, cx))  // REQUIRED for theming
        });
    });
}

Key Mental Model (React vs GPUI)

React GPUI Key Difference
useState Struct fields + cx.notify() State in struct, manual re-render trigger
Component View (impl Render) Views are Entities that render
Virtual DOM GPU rendering No diffing - rebuild elements each frame
Props drilling Entity<T> handles Pass entity handles, not callbacks

Instructions

REQUIRED: Before implementing GPUI code, load the relevant reference file(s) using the Read tool.

  1. Identify the task - What are you building?
  2. Load relevant references - Read the appropriate .md file(s) FIRST
  3. Follow patterns exactly - Use code patterns from references
  4. Check anti-patterns - Read anti-patterns.md before writing code

Reference Selection Guide

Cargo.toml

[dependencies]
gpui = "0.2.2"
gpui-component = "0.6.0-preview0"

Common Patterns

State Update Pattern

impl MyView {
    fn update_something(&mut self, cx: &mut Context<Self>) {
        self.value = new_value;
        cx.notify();  // ALWAYS call after state changes
    }
}

Button Click Pattern

Button::new("btn-id")
    .label("Click Me")
    .on_click(|_, _, cx| {
        // handle click
    })

Stateful Component Pattern

struct MyView {
    input: Entity<InputState>,  // Store entity in struct
}

impl MyView {
    fn new(window: &Window, cx: &mut Context<Self>) -> Self {
        Self {
            input: cx.new(|cx| InputState::new(window, cx)),  // Create once
        }
    }
}