gpui-component-dev

Guides creating GPUI components, stories, documentation, and PR descriptions for gpui-component.

13.7k|828|Updated Jun 13, 2024
One-click install
npx skills add https://github.com/longbridge/gpui-component --skill gpui-component-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpui-component-dev
Source: https://github.com/longbridge/gpui-component/tree/main/.claude/skills/gpui-component-dev
Command: npx skills add https://github.com/longbridge/gpui-component --skill gpui-component-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Contributing to the gpui-component Rust UI library requires following many project-specific conventions across component implementation, story creation, documentation, and PR formatting, which is easy to get wrong without guidance.

Core Features & Use Cases

  • New Component Creation: Step-by-step instructions for adding components to crates/ui, including stateless, stateful, and composite patterns, builder APIs, Styled trait implementation, and registration in lib.rs.
  • Story Writing: Patterns for creating component stories in crates/story/src/stories with section organization and full variant coverage.
  • Documentation & PR Descriptions: Conventions for writing docs in docs/docs/components and formatting GitHub PR descriptions, including a structured Breaking Changes section with diff blocks.
  • Use Case: When adding a new AlertDialog-style component, the Skill walks through file creation, WindowExt extension, story registration, and documentation so the contribution matches existing project patterns.

Quick Start

Ask the assistant to create a new GPUI component with its story, documentation, and PR description following the gpui-component project conventions.

Frequently Asked Questions about gpui-component-dev

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

FAQPage Schema
How do I create a new component in gpui-component?

Create a new file in crates/ui/src following existing patterns like Button or Select, register the module in lib.rs, and use the builder pattern for configuration. Choose stateless, stateful, or composite design based on complexity, then add a story and documentation.

How do I write a component story for gpui-component?

Create a story file in crates/story/src/stories implementing the Story trait with title and new_view methods, organize examples with section! calls, and register it in stories/mod.rs and the story list in main.rs. Cover all variants, states, and edge cases.

When should a GPUI component be stateful vs stateless?

Use stateless elements for simple presentation components like Button, and stateful elements for components managing their own data like Select with SelectState. Use composition when building on existing components, such as AlertDialog built on Dialog.

How should breaking changes be documented in gpui-component PRs?

Add a ## Breaking Changes section only when crates/ui public APIs change. List each change as a bullet with a title and a diff code block showing old versus new usage, and use ### subsections for large migrations with multiple paths.

How do I make a GPUI component accept custom styles?

Add a StyleRefinement field, implement the Styled trait returning &mut self.style, and call .refine_style(&self.style) on the root element in render(). Place it after default styles but before children so user styles override defaults.