UI Components
Overview
Studio provides a comprehensive library of custom components specifically designed for analytics interfaces. These components are built on top of Shadcn/ui and Reka UI, providing higher-level abstractions for common analytics workflows.
Studio's custom component ecosystem for analytics interfaces
Foundation
Studio leverages proven UI libraries as its foundation:
- Shadcn/ui - Provides atomic UI components (buttons, inputs, dialogs)
- Reka UI - Accessible primitives and advanced components
- Studio Components - Analytics-specific components built on this foundation
For basic UI components (buttons, inputs, forms, dialogs), refer to the Shadcn/ui documentation. Studio builds upon these primitives to create domain-specific components.
Analytics Components
Studio's custom components are organized by functional domain, providing abstractions for common analytics workflows.
Chart Components
Advanced visualization components that wrap ECharts with analytics-specific functionality.
Chart component architecture and relationships
Core Chart Components:
ChartSelector- Dynamic chart type selection with field mappingBarChart- Bar and column chart visualizationsLineChart- Line and area chart displaysDonutChart- Pie and donut chart representationsGauge- Gauge and KPI displaysSingleValue- Single metric value displaysTable- Data table with sorting and filtering
Key Features:
- Unified API: Consistent interface across all chart types
- Auto-detection: Automatic field type detection and mapping
- Responsive: Adaptive layouts for different screen sizes
- Theme Integration: Automatic light/dark theme support
- Type Safety: Full TypeScript integration with data validation
Metric Builder Components
Sophisticated form builders for creating and configuring semantic metrics.
Metric builder component composition
Builder Components:
MetricSchemaBuilder- Main orchestrator for metric configurationBasicInfoBuilder- Core metric information and propertiesMeasuresBuilder- Quantitative measurement definitionsDimensionsBuilder- Categorical attribute configurationJoinsBuilder- Table relationship specificationsFiltersBuilder- Data filtering condition setupAggregationsBuilder- Complex aggregation definitionsParametersBuilder- Runtime parameter configuration
Architecture Benefits:
- Modular Design: Independent builders for different metric aspects
- Shared State: Reactive state synchronization across builders
- Real-time Validation: Immediate feedback on configuration errors
- Preview Integration: Live preview of metric configurations
Dashboard Components
Comprehensive dashboard creation and management components.
Dashboard component hierarchy and data flow
Layout Components:
DashboardContainer- Main dashboard layout orchestratorDashboardSection- Grouped widget areas with drag-and-dropDashboardWidget- Individual widget wrapper and controlsViewWidget- Dashboard view management and switching
Configuration Components:
WidgetEditSheet- Widget configuration interfaceDataMappingEditor- Chart data mapping configurationFieldMappingSelector- Dynamic field selection and mappingPreviewChartRenderer- Real-time chart preview
Rendering Components:
ChartRenderer- Dynamic chart component renderingWidgetRenderer- Generic widget content renderingExecutionResultViewer- Query result display and formatting
Key Features:
- Drag & Drop: FormKit-powered widget arrangement
- Real-time Preview: Live dashboard execution and updates
- Grid System: Responsive grid layout for widgets
- Multi-view Support: Multiple dashboard views with switching
Resource Management Components
Components for managing workspace resources and configurations.
Resource management component patterns
Data Source Components:
CreateDataSourceDialog- Data source connection setupEditDataSourceDialog- Data source modification interfaceDataSourceSelector- Data source selection and switching
Workspace Components:
CreateWorkspaceDialog- New workspace creationEditWorkspaceDialog- Workspace configuration managementWorkspaceSelector- Workspace selection interface
Environment Components:
CreateEnvironmentDialog- Environment setup and configurationEditEnvironmentDialog- Environment modification interfaceEnvironmentSelector- Environment switching controls
Consumer Management:
CreateConsumerDialog- Consumer creation and setupCreateConsumerGroupDialog- Consumer group managementAddMemberToGroupDialog- Group membership management
Utility Components
Supporting components that provide common functionality across the application.
Utility components and their applications
Display Components:
PropertiesDisplay- Key-value property presentationKeyValuePairs- Editable key-value pair managementExecutionResultTable- Formatted query result displayMetricQueryHistory- Query execution history tracking
Selection Components:
MetricSelector- Metric selection with search and filteringColumnSelector- Database column selection interfaceContextIdBuilder- Context identifier construction
Feedback Components:
LoadingSpinner- Loading state indicationCodeHighlight- Syntax highlighted code displayThemeToggle- Light/dark theme switching
Component Architecture Patterns
Studio's components follow consistent architectural patterns that enable scalability and maintainability.
Composition Over Inheritance
How Studio components compose rather than inherit
Components are designed to be composed together rather than extended through inheritance:
- Small, Focused Components: Each component has a single responsibility
- Composable APIs: Components expose consistent prop and event interfaces
- Flexible Composition: Complex interfaces built from simple components
- Reusable Logic: Business logic extracted to composables
Reactive State Management
Reactive state flow through component hierarchies
All components integrate seamlessly with Vue's reactivity system:
- Props Down: Data flows down through props
- Events Up: User interactions bubble up through events
- Reactive Updates: Components automatically update when data changes
- Computed Properties: Derived state calculated automatically
Error Boundary Integration
Error handling patterns in Studio components
Components include comprehensive error handling:
- Graceful Degradation: Components handle errors without breaking the interface
- User Feedback: Clear error messages and recovery suggestions
- Fallback States: Alternative content when components fail to load
- Error Reporting: Automatic error tracking and reporting
Integration Patterns
How Studio components integrate with external systems and libraries.
API Integration
Component integration with API layers
Components seamlessly integrate with Cortex APIs through composables:
- Reactive Data: Components automatically update when API data changes
- Loading States: Built-in loading indicators during API calls
- Error Handling: Consistent error display across all components
- Optimistic Updates: Immediate UI feedback before API confirmation
Form Integration
Form validation and data handling patterns
Complex forms integrate VeeValidate with Zod for robust validation:
- Schema Validation: Type-safe validation with immediate feedback
- Field Dependencies: Cross-field validation and conditional logic
- Auto-save: Draft saving for complex configuration forms
- Progress Tracking: Visual indicators for multi-step forms
Chart Integration
Chart component integration with ECharts and data sources
Chart components provide sophisticated visualization capabilities:
- Data Transformation: Automatic data formatting for different chart types
- Interactive Features: Built-in zoom, pan, and selection capabilities
- Export Functionality: Chart export to various formats
- Performance Optimization: Efficient rendering for large datasets
Customization and Extension
Studio components are designed to be customizable and extensible for different use cases.
Theme Integration
Theme system integration across all components
All components respect the global theme system:
- CSS Variables: Components use semantic color tokens
- Dark Mode: Automatic dark mode support across all components
- Brand Colors: Easy customization of brand-specific colors
- Consistent Spacing: Unified spacing scale across components
Component Extension
Patterns for extending and customizing Studio components
Components can be extended and customized:
- Prop-based Customization: Extensive prop APIs for configuration
- Slot-based Content: Flexible content injection through slots
- Event Customization: Rich event APIs for custom behavior
- Style Overrides: CSS class customization for visual changes
Best Practices
Component Design
- Single Responsibility: Each component focuses on one specific task
- Consistent APIs: Similar components expose similar prop and event interfaces
- Accessibility First: All components include proper ARIA labels and keyboard navigation
- Performance Aware: Components optimize for large datasets and complex interactions
- Type Safety: Full TypeScript integration with strict prop validation
Integration Approach
- Start Simple: Begin with basic component usage before customization
- Leverage Composition: Build complex interfaces from simple components
- Use Provided Patterns: Follow established patterns for consistency
- Handle Errors: Implement proper error boundaries and fallback states
- Optimize Performance: Use lazy loading and efficient rendering patterns
Customization Strategy
- Theme Variables: Use CSS custom properties for consistent theming
- Component Variants: Extend existing components rather than creating new ones
- Composable Logic: Extract business logic to reusable composables
- Progressive Enhancement: Build core functionality first, then add enhancements
- Documentation: Document custom components and their usage patterns
Development Workflow
Component Discovery
Process for discovering and understanding Studio components
- Browse Component Structure: Explore
/app/components/directory organization - Study Usage Patterns: Examine how components are used in pages
- Review Props and Events: Understand component APIs through TypeScript interfaces
- Test Integration: Create small test implementations before full integration
Integration Process
Step-by-step component integration workflow
- Identify Requirements: Determine which components meet your needs
- Extract Components: Copy relevant components to your project
- Adapt Dependencies: Update imports and dependencies for your environment
- Customize Styling: Apply your theme and brand requirements
- Test Thoroughly: Ensure components work correctly in your context
Next Steps
- Data Flow - Understand how data flows through Studio components
- Component Patterns - Learn component design patterns
- API Integration - Master API integration with components
For basic UI components (buttons, inputs, dialogs), refer to the Shadcn/ui Vue documentation. Studio's value lies in its higher-level analytics components that orchestrate these primitives into powerful analytics workflows.