Google engineers introduce the Styles API, a new experimental feature in Jetpack Compose Foundation 1.12, designed to simplify custom design system creation. Styles separate visual appearance from component behavior, enabling state-based styling (pressed, hovered, focused, custom states), built-in animations, style inheritance and merging, and theme integration. The API offers significant performance benefits over modifiers — up to 70% fewer allocations and 2.3x faster rendering in benchmarks. A refreshed JetSnack sample app demonstrates gradient buttons, shadow animations, loading state customization, and dark/light mode theming. A companion experimental Media Query API allows styles to adapt based on device characteristics like pointer precision. The talk also clarifies when to use styles versus modifiers: styles are for visual overrides and theming, modifiers remain for behaviors, semantics, and additive layouts.

36m watch time

Sort: