new-component
How to write a new component of GPUI Component.
When & Why to Use This Skill
This Claude skill streamlines the development of GPUI components by providing a structured framework for building both stateless and stateful UI elements. It ensures architectural consistency by following established patterns (such as Shadcn UI), automates the creation of component implementations, and assists in generating necessary documentation and stories for a robust design system. By leveraging this skill, developers can maintain a unified API style and accelerate the frontend development process within the GPUI ecosystem.
Use Cases
- UI Component Scaffolding: Quickly create new GPUI elements like buttons, inputs, or sliders while adhering to the project's existing directory structure and styling conventions.
- State Management Implementation: Decide between and implement stateless presentation elements or complex stateful components (like Select or SelectState) based on data requirements.
- Design System Consistency: Ensure all new UI contributions maintain a consistent API and visual language by referencing established patterns in the UI crate.
- Documentation and Storyboarding: Automatically generate component documentation and stories in the designated folders to facilitate visual testing and team collaboration.
| name | new-component |
|---|---|
| description | Create new GPUI components. Use when building components, writing UI elements, or creating new component implementations. |
Instructions
When creating new GPUI components:
- Follow existing patterns: Base implementation on components in
crates/ui/src(examples:Button,Select) - Style consistency: Follow existing component styles and Shadcn UI patterns
- Component type decision:
- Use stateless elements for simple components (like
Button) - Use stateful elements for complex components with data (like
SelectandSelectState)
- Use stateless elements for simple components (like
- API consistency: Maintain the same API style as other elements
- Documentation: Create component documentation
- Stories: Write component stories in the story folder
Component Types
- Stateless: Pure presentation components without internal state
- Stateful: Components that manage their own state and data