Component Organization
Components in Guccho are organized into logical directories undersrc/components/:
Component Categories
T Components (UI Primitives)
TheT/ directory contains reusable UI primitives and base components:
button.vue- Base button component with variantsmodal.vue- Modal dialogstabs.vue/tab.vue- Tab navigationsingle-select.vue/multi-select.vue- Select inputscombo-box.vue- Combobox componentnuxt-link-button.vue- Button-styled links
- Reusable across the application
- Customizable with props and slots
- Type-safe with TypeScript definitions
App Components
Theapp/ directory contains application-level components:
footer.vue- Application footermode-switcher.vue- Theme/mode switcherdepends-feature.vue- Feature flag wrapperdynamic-settings.vue- Settings managementexperience.vue- Experience displaynav/- Navigation componentsscore/- Score display componentschat/- Chat functionality
Feature-Specific Components
Other directories contain components specific to particular features:- userpage/ - Profile page components (statistics, scores, rankings)
- leaderboard/ - Leaderboard display components
- content/ - Rich text editor and content management
- register/ - User registration flow
Creating Components
Component Structure
Guccho components follow this standard structure:TypeScript Integration
All components must use TypeScript with proper type definitions:Example: Button Component
Here’s the actual button component from Guccho:src/components/T/button.vue
Example: Feature-Dependent Component
Thedepends-feature.vue component shows conditional rendering based on server features:
src/components/app/depends-feature.vue
Naming Conventions
File Names
- Use kebab-case for file names:
user-profile.vue,score-list-item.vue - Use descriptive names that indicate the component’s purpose
- Client-only components should use the
.client.vuesuffix
Component Names
- Single-word component names are allowed (non-standard for Vue 3)
- Use PascalCase when referencing in templates:
<TButton />,<AppFooter /> - Prefix components with their directory name for clarity
Directory Structure
When creating related components:Component Patterns
Slots and Composition
Use slots for flexible component composition:Composables Integration
Leverage Vue composables for reusable logic:Runtime Configuration
Access runtime configuration in components:Styling Components
Tailwind CSS
Guccho uses Tailwind CSS for styling. Use utility classes in templates:DaisyUI Components
Guccho includes DaisyUI for pre-built component styles:Scoped Styles
For component-specific styles, use scoped CSS:SCSS Support
Guccho supports SCSS with the modern compiler:Best Practices
Type Safety
Always define props and emits with TypeScript types. Never use
any or skip type definitions.Single Responsibility
Each component should do one thing well. Break down complex components into smaller, reusable pieces.
Composables First
Extract reusable logic into composables rather than duplicating code across components.
Prop Validation
Use TypeScript interfaces for complex props and provide sensible defaults for optional props.
Performance Considerations
- Use
v-iffor conditional rendering when components are expensive - Use
v-showfor frequent toggling of simple elements - Lazy load heavy components with dynamic imports:
Accessibility
Ensure components are accessible:- Use semantic HTML elements
- Include ARIA labels where needed
- Ensure keyboard navigation works
- Test with screen readers
Testing Components
Before committing new components:Component Library Reference
For a complete list of available components, explore thesrc/components/ directory in the source code. Each component is self-documenting through TypeScript definitions and can serve as a reference for creating new components.
Next Steps
Contributing Guide
Learn about the full development workflow
Architecture
Understand the overall application architecture