Custom UI Components
This guide covers creating and managing custom UI components in DeployStack, including extending shadcn/vue components, building new components from scratch, and maintaining consistency across your design system.Philosophy and Approach
DeployStack follows the shadcn/vue philosophy: components are copied into your codebase and become yours to own and customize. This approach provides several key advantages:- Full Control: Direct access to component source code for unlimited customization
- No Breaking Changes: Updates don’t break your customizations since you own the code
- AI-Friendly: Open code structure allows AI tools to understand and improve components
- Design System Integration: Components naturally fit together using shared design tokens
When to Create Custom Components
Create custom components when:- Missing Components: The component doesn’t exist in shadcn/vue
- Complex Compositions: Combining multiple shadcn components into reusable patterns
- Business Logic: Components specific to DeployStack’s domain (e.g., ServerStatusCard, DeploymentProgress)
Component Structure and Organization
Directory Structure
All custom components follow the same structure as shadcn/vue components insrc/components/ui/
:
Export Pattern
Always follow the shadcn/vue export pattern:Component Development Guidelines
1. Design Token Integration
✅ Use shadcn/vue design tokens for consistency:2. Prop Interface Standards
Follow consistent prop patterns across all components:3. Class Variance Authority (CVA)
Use CVA for complex styling variants:4. Accessibility Requirements
Ensure all custom components meet accessibility standards:Component Types and Examples
1. Composite Components
Components that combine multiple shadcn components:2. Utility Components
Reusable patterns with business logic:3. Form Components
Specialized form inputs that extend basic components:Customizing Existing shadcn Components
Replacing Components
To customize an existing shadcn component, simply modify the files insrc/components/ui/[component-name]/
:
Documentation Standards
Component Documentation
Each custom component should include comprehensive documentation:README Documentation
Create aREADME.md
for complex component groups:
API Reference
ButtonGroup Props
Prop | Type | Default | Description |
---|---|---|---|
modelValue | string | string[] | undefined | Selected value(s) |
variant | 'default' | 'outline' | 'ghost' | 'default' | Visual style |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Layout direction |
Maintenance and Updates
Migration Strategy
When shadcn/vue adds a component you’ve built custom:- Evaluate: Compare features and API design
- Migrate: If shadcn version is better, plan migration
- Extend: If your version has unique features, consider contributing back
- Document: Update migration guides for the team
Version Control
- Tag component versions in commit messages:
feat(ui): add ButtonGroup component v1.0
- Document breaking changes in component README
- Maintain changelog for significant UI component updates
For questions about custom components, refer to the UI Design System documentation or reach out to the frontend team.