Prerequisites and compatibility
- Wear OS Compose Material3 version: If an internal tool is available to establish the latest stable version
{VERSION} of androidx.wear.compose:compose-material3, use that tool.
- Strict compliance: If a version is listed as stable, you MUST use it, unless overridden by the user. Do not downgrade based on initial "Unresolved reference" errors in the editor or outdated web search results.
- Kotlin version: For Wear Compose Material3, use Kotlin 2.0.0 or
higher.
- Compose compiler:
- If Kotlin version is 2.0.0+ , the project must use the
org.jetbrains.kotlin.plugin.compose Gradle plugin.
- If Kotlin version is < 2.0.0 , the project must use
kotlinCompilerExtensionVersion in composeOptions, matching the Compose to Kotlin Compatibility Map.
- Min SDK: Ensure
minSdk is at least 25 (Wear OS 2.0).
- Sample extraction mandate: Wear Compose libraries ship with an additional JAR file which contains individual samples for each and every component. You MUST NOT propose code changes until the samples in Capability 2 are extracted to the local cache. Library source files are incomplete and NOT a substitute for these samples; bypassing extraction is an environment setup failure.
Gotchas
- Mandatory sync and validation: After updating versions in
libs.versions.toml or build.gradle.kts, you must perform a Gradle sync before refactoring any code. This ensures the environment has resolved the libraries correctly.
- Prohibition of guessing (error protocol): If you encounter an 'Unresolved Reference' or API mismatch after a successful sync, do not attempt to 'fix' it by downgrading the library version.
Capabilities and tools
Capability 1: Migration
Use this guidance when migrating from an older version of Wear OS Compose or
Horologist.
- Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from
{VERSION}.
- Read the migration guide.
- Use the official component mappings from the migration guide.
- Before refactoring any component (for example,
Chip -> Button), check the parameter names, slot types, and "Expressive" design tokens.
- Do not use the Horologist Composables, Compose Layout, or Compose Material libraries.
- Always check against the component guidance in Capability 3.
- Expect screenshot tests to fail when a migration has been performed: Even when migrating to very similar components, expected defaults for padding and positioning will have changed. Do not seek to artificially match the pre-migration screenshot, but give preference to the Material3 defaults.
Capability 2: Component samples
Wear Compose includes individual component samples for each and every component,
within the <artifact>-<version>-samples-sources.jar file. Gradle automatically
downloads these JAR files along with the main library JAR when using any of
compose-material3, compose-foundation or compose-navigation3.
Use the canonical component samples whenever adding or adjusting a Wear Compose
Material3 component.
STRICT COMPLIANCE: Extraction is NOT optional. You are FORBIDDEN from
implementing any code until samples are extracted and read. Bypassing this step
with alternative search tools or by assuming library documentation is sufficient
is a protocol breach. You MUST verify the local cache by reading a sample file
before proceeding.
Step 1: Prepare
- Check the
build.gradle.kts or libs.versions.toml to ensure the Wear Compose version matches {VERSION}.
- Ensure that the necessary dependencies are downloaded by doing a Gradle sync.
Step 2: Check the local cache
- Define the cache directory path:
<SKILL_ROOT>/samples/{VERSION}/. Do NOT choose your own different location.
- Check if this directory exists and contains subdirectories with
.kt files.
- IF YES (cache hit): Proceed to Step 4.
- IF NO (cache miss): Proceed to Step 3.
Step 3: Check the Gradle cache
Sample sources are stored in the Gradle cache. To avoid slow, brute-force searches:
- Determine the Gradle user home (usually
~/.gradle, or check $GRADLE_USER_HOME).
- The cache root is
<GRADLE_USER_HOME>/caches. Call this <CACHE_ROOT>.
Define {ARTIFACT} as the items in the list ["material3", "foundation"]. Also include "navigation3" in the list if the androidx.wear.compose.navigation3 library is being used.
For each {ARTIFACT} in the list:
Construct the expected relative path segment for the library: androidx.wear.compose/compose-{ARTIFACT}/{VERSION}.
Run a targeted find command. Here is an example which is constructed
for efficiency:
find <CACHE_ROOT>/modules-2/files-2.1/androidx.wear.compose/compose-{ARTIFACT}/{VERSION}/ \
-name "*samples-sources.jar"
Use this JAR as the official sample sources.
Extract the contents of each JAR to
<SKILL_ROOT>/samples/{VERSION}/{ARTIFACT}/ using unzip -j to flatten the
structure.
Proceed directly to step 4.
Step 4: Read samples and implement
- Read the relevant
.kt sample files.
- Use these official, version-matched samples as the source of truth for:
- Required parameters and slot names.
- Default styling and typography tokens.
- Interactive behaviors (for example:
onClick, onLongClick).
- Component nesting (for example:
AppScaffold -> ScreenScaffold).
Capability 3: Component guidance
Mandatory: Use this capability as a checklist against any component use. It
provides more holistic guidance on how to use each component in practice, beyond
the component syntax.
AppScaffold and ScreenScaffold
- [ ] Use
AppScaffold as the outer container, with ScreenScaffold children.
- [ ] Use only ONE
AppScaffold and any number of ScreenScaffold.
ScalingLazyColumn - Use TransformingLazyColumn instead.
TransformingLazyColumn - You will need the following imports:
import androidx.wear.compose.foundation.lazy.TransformingLazyColumn
import androidx.wear.compose.foundation.lazy.TransformingLazyColumnDefaults
import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState
// ...
import androidx.wear.compose.material3.lazy.rememberTransformationSpec
import androidx.wear.compose.material3.lazy.transformedHeight
Canonical example:
val columnState = rememberTransformingLazyColumnState()
val transformationSpec = rememberTransformationSpec()
ScreenScaffold(
scrollState = columnState
) { contentPadding ->
TransformingLazyColumn(
state = columnState,
contentPadding = contentPadding
) {
item {
ListHeader(
modifier = Modifier
.fillMaxWidth()
.transformedHeight(this, transformationSpec)
.minimumVerticalContentPadding(ListHeaderDefaults.minimumTopListContentPadding),
transformation = SurfaceTransformation(transformationSpec)
) {
Text(text = "Header")
}
}
// ... other items
item {
Button(
modifier = Modifier
.fillMaxWidth()
.transformedHeight(this, transformationSpec)
.minimumVerticalContentPadding(ButtonDefaults.minimumVerticalListContentPadding),
transformation = SurfaceTransformation(transformationSpec),
/* ... */ },
icon = {
Icon(
imageVector = Icons.Default.Build,
contentDescription = "build",
)
},
) {
Text(
text = "Build",
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
}
}
- [ ] Use
TransformingLazyColumn instead of ScalingLazyColumn.
- [ ] You must pass the
contentPadding parameter from ScreenScaffold to the TransformingLazyColumn.
- [ ] Use the
minimumVerticalContentPadding modifier to achieve required padding top and bottom.
- This expects a value from defaults, such as
ButtonDefaults, CardDefaults, `ListHeaderDefaults.
- Note: This is a scoped modifier available within
TransformingLazyColumnItemScope.
- [ ] Ensure the list morphs and scales.
- [ ] Use
transformedHeight modifier.
- [ ] Use
transform = SurfaceTransform(...).
- [ ] If configuring a list for snapping, use
flingBehavior and rotaryScrollableBehavior together:
val columnState = rememberTransformingLazyColumnState()
ScreenScaffold(scrollState = columnState) { contentPadding ->
TransformingLazyColumn(
state = columnState,
flingBehavior = TransformingLazyColumnDefaults.snapFlingBehavior(columnState),
rotaryScrollableBehavior = RotaryScrollableDefaults.snapBehavior(columnState)
) {
// ...
// ...
}
}
ScreenScaffold
- [ ] Guard the
scrollIndicator with !LocalScrollCaptureInProgress.current.
EdgeButton
- [ ] Do NOT use as the final item within a
TransformingLazyColumn. Instead, use the slot in ScreenScaffold.
- [ ] When used in a
TransformingLazyColumn, add the required overscroll behavior:
val columnState = rememberTransformingLazyColumnState()
ScreenScaffold(
scrollState = columnState,
edgeButton = {
EdgeButton(
/* TODO */ },
modifier = Modifier.scrollable(
columnState,
orientation = Orientation.Vertical,
reverseDirection = true,
// Apply overscroll to the EdgeButton for proper scrolling behavior.
overscrollEffect = rememberOverscrollEffect(),
)
) {
Text("More")
}
}
) { contentPadding ->
TransformingLazyColumn(
contentPadding = contentPadding,
state = columnState,
) {
// ...
// ...
}
}
Column
- [ ] USE as a direct child of
ScreenScaffold if the screen is will never scroll, even with the largest system font.
- [ ] Use
TransformingLazyColumn instead for all other cases.
Styles
- [ ] Do NOT hard-code text sizes, use
typography from MaterialTheme.
- [ ] Do NOT hard-code colors, use
colorScheme from MaterialTheme.
Use component defaults:
- [ ] Components such as
Button have a corresponding ButtonDefaults object.
- Check for and use the
*Defaults object for any component when working with padding and styling values, in preference to hard-coded values.
Use Wear specific previews:
- [ ]
WearPreviewDevices
- [ ]
WearPreviewFontScales
Ambient mode
- [ ] Use
LocalAmbientModeManager instead of AmbientLifecycleObserver.
Navigation
- [ ] When adding navigation fresh, use Navigation3.
- [ ] For Navigation3 in Wear OS, use
SwipeDismissableSceneStrategy() from the Wear Compose compose-navigation3 library.
1---2name: jetpack-compose-m33description: Expert guidance for working with Wear OS Compose Material3. Use this skill when creating, updating or migrating Wear OS projects. This includes the androidx.wear.compose.material3, androidx.wear.compose.foundation and androidx.wear.compose.navigation3 libraries. Also working with core components such as AppScaffold, ScreenScaffold and TransformingLazyColumn. Migration from earlier versions such as Material 2.5 and Horologist.4license: Complete terms in LICENSE.txt5---67## Prerequisites and compatibility891. **Wear OS Compose Material3 version:** If an internal tool is available to establish the **latest stable version** `{VERSION}` of `androidx.wear.compose:compose-material3`, use that tool.10 - Otherwise, fetch the [official Maven metadata XML](https://dl.google.com/dl/android/maven2/androidx/wear/compose/compose-material3/maven-metadata.xml) to identify `{VERSION}` (highest number, ignoring `-alpha`, `-beta`, or `-rc`).112. **Strict compliance:** If a version is listed as stable, you MUST use it, unless overridden by the user. Do not downgrade based on initial "Unresolved reference" errors in the editor or outdated web search results.123. **Kotlin version:** For Wear Compose Material3, use Kotlin **2.0.0 or13 higher**.144. **Compose compiler:**15 - If Kotlin version is **2.0.0+** , the project must use the `org.jetbrains.kotlin.plugin.compose` Gradle plugin.16 - If Kotlin version is **\< 2.0.0** , the project must use `kotlinCompilerExtensionVersion` in `composeOptions`, matching the [Compose to Kotlin Compatibility Map](https://developer.android.com/jetpack/androidx/releases/compose-kotlin).175. **Min SDK:** Ensure `minSdk` is at least **25** (Wear OS 2.0).186. **Sample extraction mandate**: Wear Compose libraries ship with an additional JAR file which contains individual samples for each and every component. You MUST NOT propose code changes until the samples in Capability 2 are extracted to the local cache. Library source files are incomplete and NOT a substitute for these samples; bypassing extraction is an environment setup failure.1920## Gotchas21221. **Mandatory sync and validation:** After updating versions in `libs.versions.toml` or `build.gradle.kts`, you **must** perform a Gradle sync before refactoring any code. This ensures the environment has resolved the libraries correctly.232. **Prohibition of guessing (error protocol):** If you encounter an 'Unresolved Reference' or API mismatch after a successful sync, do not attempt to 'fix' it by downgrading the library version.2425## Capabilities and tools2627### Capability 1: Migration2829Use this guidance when migrating from an older version of Wear OS Compose or30Horologist.31321. Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from `{VERSION}`.332. Read the [migration guide](references/android/training/wearables/compose/migrate-to-material3.md).343. Use the official component mappings from the migration guide.354. Before refactoring any component (for example, `Chip` -\> `Button`), check the parameter names, slot types, and "Expressive" design tokens.365. Do not use the Horologist Composables, Compose Layout, or Compose Material libraries.376. **Always** check against the component guidance in Capability 3.387. Expect screenshot tests to fail when a migration has been performed: Even when migrating to very similar components, expected defaults for padding and positioning will have changed. Do not seek to artificially match the pre-migration screenshot, but give preference to the Material3 defaults.3940### Capability 2: Component samples4142Wear Compose includes individual component samples for each and every component,43within the `<artifact>-<version>-samples-sources.jar` file. Gradle automatically44downloads these JAR files along with the main library JAR when using any of45`compose-material3`, `compose-foundation` or `compose-navigation3`.4647Use the canonical component samples whenever adding or adjusting a Wear Compose48Material3 component.4950STRICT COMPLIANCE: Extraction is NOT optional. You are FORBIDDEN from51implementing any code until samples are extracted and read. Bypassing this step52with alternative search tools or by assuming library documentation is sufficient53is a protocol breach. You MUST verify the local cache by reading a sample file54before proceeding.5556#### Step 1: Prepare57581. Check the `build.gradle.kts` or `libs.versions.toml` to ensure the Wear Compose version matches `{VERSION}`.592. Ensure that the necessary dependencies are downloaded by doing a Gradle sync.6061#### Step 2: Check the local cache62631. Define the cache directory path: `<SKILL_ROOT>/samples/{VERSION}/`. Do NOT choose your own different location.642. Check if this directory exists and contains subdirectories with `.kt` files.65 - **IF YES (cache hit):** Proceed to **Step 4**.66 - **IF NO (cache miss):** Proceed to **Step 3**.6768#### Step 3: Check the Gradle cache69701. Sample sources are stored in the Gradle cache. To avoid slow, brute-force searches:71 - Determine the Gradle user home (usually `~/.gradle`, or check `$GRADLE_USER_HOME`).72 - The cache root is `<GRADLE_USER_HOME>/caches`. Call this `<CACHE_ROOT>`.732. Define `{ARTIFACT}` as the items in the list `["material3", "foundation"]`. Also include "navigation3" in the list if the `androidx.wear.compose.navigation3` library is being used.743. For each `{ARTIFACT}` in the list:7576 - Construct the expected relative path segment for the library: `androidx.wear.compose/compose-{ARTIFACT}/{VERSION}`.77 - Run a targeted `find` command. Here is an example which is constructed78 for efficiency:7980 find <CACHE_ROOT>/modules-2/files-2.1/androidx.wear.compose/compose-{ARTIFACT}/{VERSION}/ \81 -name "*samples-sources.jar"82834. Use this JAR as the official sample sources.84855. Extract the contents of each JAR to86 `<SKILL_ROOT>/samples/{VERSION}/{ARTIFACT}/` using `unzip -j` to flatten the87 structure.88896. Proceed **directly to step 4**.9091#### Step 4: Read samples and implement92931. Read the relevant `.kt` sample files.942. Use these official, version-matched samples as the source of truth for:95 - Required parameters and slot names.96 - Default styling and typography tokens.97 - Interactive behaviors (for example: `onClick`, `onLongClick`).98 - Component nesting (for example: `AppScaffold` -\> `ScreenScaffold`).99100### Capability 3: Component guidance101102**Mandatory**: Use this capability as a checklist against any component use. It103provides more holistic guidance on how to use each component in practice, beyond104the component syntax.1051061. `AppScaffold` and `ScreenScaffold`107 - \[ \] Use `AppScaffold` as the outer container, with `ScreenScaffold` children.108 - \[ \] Use only **ONE** `AppScaffold` and any number of `ScreenScaffold`.1092. `ScalingLazyColumn` - Use `TransformingLazyColumn` instead.1103. `TransformingLazyColumn` - You will need the following imports:111112113 ```kotlin114 import androidx.wear.compose.foundation.lazy.TransformingLazyColumn115 import androidx.wear.compose.foundation.lazy.TransformingLazyColumnDefaults116 import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState117 // ...118 import androidx.wear.compose.material3.lazy.rememberTransformationSpec119 import androidx.wear.compose.material3.lazy.transformedHeight120 ```121122 <br />123124 **Canonical example**:125126127 ```kotlin128 val columnState = rememberTransformingLazyColumnState()129 val transformationSpec = rememberTransformationSpec()130 ScreenScaffold(131 scrollState = columnState132 ) { contentPadding ->133 TransformingLazyColumn(134 state = columnState,135 contentPadding = contentPadding136 ) {137 item {138 ListHeader(139 modifier = Modifier140 .fillMaxWidth()141 .transformedHeight(this, transformationSpec)142 .minimumVerticalContentPadding(ListHeaderDefaults.minimumTopListContentPadding),143 transformation = SurfaceTransformation(transformationSpec)144 ) {145 Text(text = "Header")146 }147 }148 // ... other items149 item {150 Button(151 modifier = Modifier152 .fillMaxWidth()153 .transformedHeight(this, transformationSpec)154 .minimumVerticalContentPadding(ButtonDefaults.minimumVerticalListContentPadding),155 transformation = SurfaceTransformation(transformationSpec),156 onClick = { /* ... */ },157 icon = {158 Icon(159 imageVector = Icons.Default.Build,160 contentDescription = "build",161 )162 },163 ) {164 Text(165 text = "Build",166 maxLines = 1,167 overflow = TextOverflow.Ellipsis,168 )169 }170 }171 }172 }173 ```174175 <br />176177 - \[ \] Use `TransformingLazyColumn` instead of `ScalingLazyColumn`.178 - \[ \] You must pass the `contentPadding` parameter from `ScreenScaffold` to the `TransformingLazyColumn`.179 - \[ \] Use the `minimumVerticalContentPadding` modifier to achieve required padding top and bottom.180 - This expects a value from defaults, such as `ButtonDefaults`, `CardDefaults`, \`ListHeaderDefaults.181 - Note: This is a scoped modifier available within `TransformingLazyColumnItemScope`.182 - \[ \] Ensure the list morphs and scales.183 - \[ \] Use `transformedHeight` modifier.184 - \[ \] Use `transform = SurfaceTransform(...)`.185 - \[ \] If configuring a list for snapping, use `flingBehavior` and `rotaryScrollableBehavior` **together**:186187188 ```kotlin189 val columnState = rememberTransformingLazyColumnState()190 ScreenScaffold(scrollState = columnState) { contentPadding ->191 TransformingLazyColumn(192 state = columnState,193 flingBehavior = TransformingLazyColumnDefaults.snapFlingBehavior(columnState),194 rotaryScrollableBehavior = RotaryScrollableDefaults.snapBehavior(columnState)195 ) {196 // ...197 // ...198 }199 }200 ```201202 <br />2032044. `ScreenScaffold`205206 - \[ \] Guard the `scrollIndicator` with `!LocalScrollCaptureInProgress.current`.2075. `EdgeButton`208209 - \[ \] Do **NOT** use as the final item within a `TransformingLazyColumn`. Instead, use the slot in `ScreenScaffold`.210 - \[ \] When used in a `TransformingLazyColumn`, add the required overscroll behavior:211212213 ```kotlin214 val columnState = rememberTransformingLazyColumnState()215 ScreenScaffold(216 scrollState = columnState,217 edgeButton = {218 EdgeButton(219 onClick = { /* TODO */ },220 modifier = Modifier.scrollable(221 columnState,222 orientation = Orientation.Vertical,223 reverseDirection = true,224 // Apply overscroll to the EdgeButton for proper scrolling behavior.225 overscrollEffect = rememberOverscrollEffect(),226 )227 ) {228 Text("More")229 }230 }231 ) { contentPadding ->232 TransformingLazyColumn(233 contentPadding = contentPadding,234 state = columnState,235 ) {236 // ...237 // ...238 }239 }240 ```241242 <br />2432446. `Column`245246 - \[ \] USE as a direct child of `ScreenScaffold` *if* the screen is will **never** scroll, even with the largest system font.247 - \[ \] Use `TransformingLazyColumn` instead for all other cases.2487. Styles249250 - \[ \] Do **NOT** hard-code text sizes, use `typography` from `MaterialTheme`.251 - \[ \] Do **NOT** hard-code colors, use `colorScheme` from `MaterialTheme`.2528. Use component defaults:253254 - \[ \] Components such as `Button` have a corresponding `ButtonDefaults` object.255 - Check for and use the `*Defaults` object for any component when working with padding and styling values, in preference to hard-coded values.2569. Use Wear specific previews:257258 - \[ \] `WearPreviewDevices`259 - \[ \] `WearPreviewFontScales`26010. Ambient mode261262 - \[ \] Use `LocalAmbientModeManager` instead of `AmbientLifecycleObserver`.26311. Navigation264265 - \[ \] When adding navigation fresh, use Navigation3.266 - \[ \] For Navigation3 in Wear OS, use `SwipeDismissableSceneStrategy()` from the Wear Compose `compose-navigation3` library.