If you're writing Compose code for your app or building Compose libraries and APIs, follow best practices to make your code scalable, more performant, and consistent with the rest of the ecosystem.
The following documents provide guidelines for anyone writing code that uses Compose:
- API Guidelines for Jetpack Compose: Outlines patterns, best
practices, and prescriptive style guidelines for any system using the Jetpack
Compose compiler plugin and runtime. It includes the following topics:
- Kotlin style guidelines for Compose, based on the Kotlin Coding Conventions
- Guidance for
@Composablefunctions and APIs that build on the Compose runtime capabilities
- Guidelines for APIs that use and extend the Compose UI toolkit
- Patterns for addressing use cases when designing a Compose API
- API Guidelines for
@Composablecomponents in Jetpack Compose: Provides a set of guidelines and recommendations for creating and using
@ComposableUI components, including the following topics:
- Creating and layering components
- Naming a new component
- Expressing component dependencies
- Parameters in
- Following correct patterns for creating component-related classes and functions
- Improving accessibility for components
- Updating component APIs while retaining backwards compatibility
These guidelines are written for the following three audiences:
- Developers building apps based on Jetpack Compose. You are in this group if you use Jetpack Compose in some part of your app.
- Developers working on Jetpack Compose framework development. You are in
this group if you make contributions to the
- Developers creating libraries based on Jetpack Compose. You are in this group if you create Compose APIs or libraries of Compose UI elements. These libraries of Compose components may be publicly available or local to your company or team.
Depending on the group you're in, you have different strictness levels for each style guideline. For example, Jetpack Compose framework development generally adheres most strictly to these guidelines.
For more information about the requirements for each developer audience, see RFC2119.
Contribute to framework and guidelines
To contribute, follow the instructions in the