gpui-element

Implement GPUI Element traits for custom layout, prepaint, and paint phases.

62|1|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/zerx-lab/rmx --skill gpui-element
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpui-element
Source: https://github.com/zerx-lab/rmx/tree/main/.opencode/skills/gpui-element
Command: npx skills add https://github.com/zerx-lab/rmx --skill gpui-element

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

GPUI's low-level Element API lets developers build highly optimized custom UI components that require fine-grained control over layout, prepaint, and paint phases.

Core Features & Use Cases

  • Low-level control over three rendering phases (request_layout, prepaint, paint) for custom UI behaviors.
  • Custom layouts and hitboxes enabling precise interaction models and optimized rendering paths.
  • Use Case: Implement a bespoke dashboard widget that needs a non-standard layout and advanced hit-testing.

Quick Start

Implement the Element trait for your component, supply RequestLayoutState and PrepaintState, and integrate it into a GPUI tree by wrapping it in a container element such as a div.

Frequently Asked Questions about gpui-element

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

FAQPage Schema
How do I get low-level control over rendering phases in GPUI?

Low-level control over rendering in GPUI is achieved by implementing the Element trait with associated RequestLayoutState and PrepaintState. This exposes precise lifecycle methods for managing request_layout, prepaint, and paint phases directly.

When do I need custom hitboxes and layouts in GPUI?

Custom hitboxes and layouts in GPUI are needed for performance-critical components requiring precise interaction models and non-standard rendering paths, such as bespoke dashboard widgets with advanced hit-testing.

How do I implement a custom element in a GPUI tree?

To implement a custom element in GPUI, implement the Element trait and supply RequestLayoutState and PrepaintState. Integrate it into the GPUI tree by wrapping the component in a container element like a div.

Does GPUI support fine-grained prepaint and paint phases for custom UI?

Yes, GPUI supports fine-grained prepaint and paint phases. The low-level Element API exposes Window's lifecycle methods, allowing developers to manage layout, prepaint, painting, and interaction handling for custom UI behaviors.

What states are required to build a custom layout in GPUI?

Building a custom layout in GPUI requires implementing the Element trait with associated states for RequestLayoutState and PrepaintState. These states manage the lifecycle methods needed for optimized rendering and interaction handling.

What are the limitations of using GPUI's low-level Element API?

The low-level Element API in GPUI requires advanced implementation of Element with associated states and manual management of layout, prepaint, and paint phases, making it complex for standard UI components that do not need maximum rendering control.