gpui

Provides reference guidance for building GPUI framework applications in Rust.

Updated Aug 1, 2026
One-click install
npx skills add https://github.com/thechibbis/mythicreviewer --skill gpui-thechibbis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpui
Source: https://github.com/thechibbis/mythicreviewer/tree/main/.agents/skills/gpui
Command: npx skills add https://github.com/thechibbis/mythicreviewer --skill gpui-thechibbis

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? GPUI is a complex Rust UI framework with many interlocking concepts—contexts, entities, elements, async tasks, and focus handling—and developers often struggle to find the right API or pattern for a given task. This Skill organizes GPUI knowledge into topic-specific reference files so the correct guidance is loaded exactly when needed. ## Core Features & Use Cases - Topic-Based Navigation: A routing table in SKILL.md maps tasks (actions, async, context, elements, entities, events, focus, globals, layout, testing) to dedicated reference files. - Deep-Dive References: Extended guides cover the low-level Element trait lifecycle (request_layout, prepaint, paint), entity state management patterns, and the testing API with TestAppContext. - Best Practices & Pitfalls: Documents common errors such as updating entities from background threads or re-entering entity locks inside defer_in callbacks. - Use Case: When implementing a custom scrollable list element in a GPUI app, load the element pattern references to correctly structure layout state, hitboxes, and scroll event handling. ## Quick Start Ask for help implementing a GPUI feature such as keybindings, async data fetching, or a custom element, and the relevant reference file will be loaded to guide the implementation.

Frequently Asked Questions about gpui

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a custom element in GPUI?

Implement the Element trait with RequestLayoutState and PrepaintState associated types, plus request_layout, prepaint, and paint methods. Create hitboxes in prepaint, pass state through the associated types, and avoid allocations in the paint phase.

How do I run async tasks in GPUI?

Use cx.spawn for foreground tasks that update entities and cx.background_spawn for CPU-intensive work on background threads. Chain background results back to the foreground with .then(cx.spawn(...)) since entities can only be updated on the UI thread.

How do keybindings and actions work in GPUI?

Define actions with the actions! macro or #[derive(Action)], bind keys with cx.bind_keys using KeyBinding::new, and handle them with .on_action(cx.listener(...)) on elements. Use key_context to scope bindings so the same key can trigger different actions per context.

Why does GPUI panic with 'cannot update while it is already being updated'?

This happens when entity.update is called on the same entity inside a defer_in callback, re-entering its lock. Use the &mut reference provided directly by the defer_in callback instead of calling update on that entity.

When does a GPUI element need an ElementId?

An ElementId is required for elements that handle mouse events, store keyed state via window.use_keyed_state, or need interaction tracking. Call .id() on a div to make it stateful; IDs only need uniqueness within the same stateful parent scope.

How do I test GPUI components?

Use the #[gpui::test] attribute with TestAppContext for logic tests and VisualTestContext for rendering tests. You can open windows, dispatch mouse events, and assert on entity state within the test context.