What problem does it solve?
Styles help you centralize and theme visual properties in Jetpack Compose, replacing scattered, hard-coded styling with a consistent, theme-driven approach that supports state-based visuals.
Core Features & Use Cases
- Jetpack Compose Styles API setup: Upgrade dependencies and opt into the required experimental Compose Style APIs to enable the Style pipeline.
- Themeable component styling: Define reusable component styles (ComponentStyles) and wire them into your custom theme so multiple components share a unified look.
- Migration workflow from Modifiers/parameters: Replace hard-coded styling parameters with a Style parameter and apply styleable modifiers for components that don’t expose Style parameters.
- State and interaction styling: Use StyleState-driven state blocks (pressed/hovered/focused/enabled/toggled and custom states) to animate and switch visual properties.
Quick Start
Update your project to the required Compose Foundation Style API versions and experimental opt-in, then create ComponentStyles.kt to define your component Style objects and migrate one custom component at a time by adding style: Style = Style and applying Modifier.styleable with a StyleState linked to your interaction source.