gpui-patterns

Installation
SKILL.md

For always-loaded rules see CLAUDE.md. This skill provides detailed patterns and examples.

GPUI Patterns

Essential patterns for building UI with GPUI in Script Kit.

Quick Reference (Things That Break Most Often)

  • Layout chain order: Layout (flex*) → Sizing (w/h) → Spacing (px/gap) → Visual (bg/border)
  • Lists: uniform_list (fixed height 52px) + UniformListScrollHandle
  • Theme colors: use theme.colors.* (never rgb(0x...))
  • Focus colors: use theme.get_colors(is_focused); re-render on focus change
  • State updates: after render-affecting changes, must cx.notify()
  • Keyboard: primary pattern is .on_key_down(handler) + crate::ui_foundation::is_key_* helpers
  • Printable chars: printable_char(event.keystroke.key_char.as_deref())
  • Focus events: keyboard handlers need the focus trio: .track_focus(...) + .on_key_down(...) + .child(...)

Keyboard Handling (CRITICAL)

Related skills
Installs
1
GitHub Stars
21
First Seen
Mar 21, 2026