gpui-focus-handle

Manage keyboard focus and navigation with GPUI focus handles and focus events.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

GPUI focus management ensures keyboard navigation and focus tracking across focusable elements, enabling accessible and predictable user interfaces.

Core Features & Use Cases

  • FocusHandle: A reference to a focusable element that persists across renders.
  • Focus Tracking: Keeps track of the current focused element and updates UI accordingly.
  • Keyboard Navigation: Supports Tab/Shift-Tab traversal and focus events (on_focus, on_blur).
  • Use Case: Build a dialog or form where focus is trapped within the container and returns to the prior element when closed.

Quick Start

Create a FocusHandle in your component: let focus_handle = cx.focus_handle(); Attach to elements: div().track_focus(&focus_handle); Respond to focus: .on_focus(cx.listener(|this, _event, cx| { /* handle focus */ }))

Frequently Asked Questions about gpui-focus-handle

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

FAQPage Schema
How do I manage keyboard focus and navigation in GPUI?

You can respond to focus changes in GPUI by attaching on_focus and on_blur event listeners to your elements. These events trigger during component renders, allowing you to update the UI based on the current focus state.

How do I trap focus inside a GPUI dialog or form container?

Trapping focus inside a GPUI dialog involves using a FocusHandle to manage the focusable elements within the container. When the dialog closes, the focus handle returns focus to the prior element that was previously active.

What is the best way to track the current focused element in a GPUI app?

You can implement tab-based navigation in GPUI by applying track_focus with a FocusHandle to your focusable elements. This setup natively supports Tab and Shift-Tab keyboard traversal for accessible user interfaces.

Does GPUI support event-driven focus transitions during component renders?

GPUI supports event-driven focus transitions during component renders by utilizing on_focus and on_blur listeners. This ensures predictable focus shifts when components update or re-render in the interface.