ComponentsDir property.
Overview
Lumo UI requires a specific directory structure that aligns with your Kotlin package names. TheComponentsDir property in lumo.properties tells the plugin where to generate UI components.
Directory Structure Requirements
Package-Directory Alignment
The most important rule: Your directory structure must match your package name.ComponentsDir Configuration
What is ComponentsDir?
A relative path from the project root to the directory where Lumo UI will generate and manage UI components.Key Points:
- Path is relative to project root
- Must be an existing directory
- Must align with the package structure
- Uses forward slashes (/) as separators
Validation Process
When you run Lumo UI, it validates your configuration:-
Directory Existence Check
- Verifies that the directory exists
- Creates the directory if needed (in some cases)
-
Package Alignment Check
- Converts the directory path to package format
- Compares it with the
PackageName - Ensures they match
ConfigurationValidator.kt
Sample Project Structures
Sample Android Project
Based on the reference sample project:Android Sample
Sample Multiplatform Project
Multiplatform Sample
Generated Files
When properly configured, Lumo UI generates these core files in yourComponentsDir:
Core Theme Files
Theme.kt
Theme.kt
The main theme composable that wraps your application. Contains:
AppThemecomposable function- Theme configuration and setup
- CompositionLocal providers
- Dark/light mode handling
{ComponentsDir}/Theme.ktColor.kt
Color.kt
Color definitions and color schemes. Contains:
- Predefined color palettes (Gray, Red, Blue, Green)
Colorsdata classLightColorsandDarkColorsschemesAppColorsconfiguration- Color utility functions
{ComponentsDir}/Color.ktTypography.kt
Typography.kt
Typography system and text styles. Contains:
Typographydata class- Default text styles (h1-h4, body1-3, label1-3, button, input)
- Font family configuration
- Font scaling utilities
{ComponentsDir}/Typography.ktComponent Subdirectories
Components are typically organized in subdirectories:Creating the Directory Structure
Manual Setup
-
Determine your package name:
-
Create the directory structure:
-
Update lumo.properties:
Using the Plugin Initialization
Run the initialization command and then create the directory:Multi-Module Projects
For multi-module projects, choose one module for UI components:Multi-Module Structure
Path Separators
Cross-Platform Compatibility
Lumo UI handles different path separators:- Forward slashes (/): Recommended for all platforms
- Backslashes (\): Windows-style, automatically converted
lumo.properties:
Good
Also Works
Common Issues and Solutions
Error: Components directory does not exist
Error: Components directory does not exist
Problem: The directory specified in
ComponentsDir doesn’t exist.Solution:Warning: Directory and package name do not match
Warning: Directory and package name do not match
Problem: The directory structure doesn’t align with the package name.Example:
- ComponentsDir:
app/src/main/java/com/example/ui - PackageName:
com.myapp.design.ui
Incorrect package declarations in generated files
Incorrect package declarations in generated files
Problem: Generated files have wrong package declarations.Solution: Verify that:
ComponentsDirpoints to the correct directoryPackageNamematches the directory structure- The directory exists before running the plugin
Best Practices
Use Descriptive Paths
Make your component directory path clear and descriptive:
ui-components/src/.../ui✓shared/design-system/...✓src/...✗ (too generic)
Dedicated UI Module
Consider creating a dedicated module for UI components in larger projects to keep them separate from business logic.
Consistent Naming
Use consistent naming conventions:
- Package:
com.company.app.ui - Module:
ui-componentsordesign-system
Source Control
Commit both
lumo.properties and generated files to version control to ensure team consistency.Verification
After setting up your directory structure, verify it works:Theme.ktColor.ktTypography.kt- Component subdirectories
Next Steps
lumo.properties
Complete configuration reference
Theme Customization
Customize your theme