Prerequisites and compatibility
- Current Wear OS Compose version in-use: To find the installed library version, read
gradle/libs.versions.toml or build.gradle.kts directly. Don't run ./gradlew dependencies or other shell commands to resolve versions.
- 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.
- Sample extraction mandate: Wear Compose libraries ship with an additional JAR file which contains individual samples for each and every component. You mustn't propose code changes, other than previews or basic changes such as color changes, until the samples in Capability 3 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 4.
- 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: Adding Wear OS Compose Material3 features or updating the app
Use this guidance when the developer asks to update a project which is using an
earlier version of Wear OS Compose Material3, or when they ask to add further
features.
- Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from
{VERSION}.
- Do not use the Horologist Composables, Compose Layout, or Compose Material libraries.
- Always check against the component guidance in Capability 4.
- 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 3: 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.
Exception: You don't need to extract samples if the request is strictly related
to tooling (for example, adding @WearPreviewDevices), updating text/colors, or
basic refactoring that doesn't involve adding new Wear Compose components.
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:
/tmp/wear-compose-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: Network-based sample retrieval
Google Maven publishes a -samples-sources.jar alongside every library release.
Download and extract it directly without needing a local Gradle sync or cache
lookup.
Determine the {VERSION} of androidx.wear.compose:compose-material3 from build.gradle.kts or libs.versions.toml.
Define {ARTIFACT} as the items in the list ["material3", "foundation"]. Also include navigation3 if androidx.wear.compose.navigation3 is used.
For each {ARTIFACT}, run the following commands to download and extract
the samples:
# Download the samples-sources JAR
curl -sSL "https://dl.google.com/dl/android/maven2/androidx/wear/compose/compose-{ARTIFACT}/{VERSION}/compose-{ARTIFACT}-{VERSION}-samples-sources.jar" -o {ARTIFACT}-{VERSION}-samples.jar
# Extract and flatten into the cache directory
unzip -q -o {ARTIFACT}-{VERSION}-samples.jar -d /tmp/wear-compose-samples/{VERSION}/{ARTIFACT}/
# Clean up
rm {ARTIFACT}-{VERSION}-samples.jar
If this works, 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 4: 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.
Comments
- [ ] Where any Kotlin file has been modified, ensure that the existing comments are up to date and accurately reflect any changes to the implementation.
HorizontalPager or VerticalPager
- [ ] Use the Composable hierarchy in this order:
AppScaffold, HorizontalPagerScaffold, HorizontalPager, AnimatedPage, ScreenScaffold. Or similarly for VerticalPager.
1---2name: wear-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, and core Wear OS concepts such as ambient mode. Migration from lower versions such as Material 2.5 and Horologist.4license: Complete terms in LICENSE.txt5---67## Prerequisites and compatibility891. **Current Wear OS Compose version in-use:** To find the installed library version, read `gradle/libs.versions.toml` or `build.gradle.kts` directly. Don't run `./gradlew dependencies` or other shell commands to resolve versions.102. **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.11 - 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`).123. **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.134. **Kotlin version:** For Wear Compose Material3, use Kotlin **2.0.0 or14 higher**.155. **Compose compiler:**16 - If Kotlin version is **2.0.0+** , the project must use the `org.jetbrains.kotlin.plugin.compose` Gradle plugin.17 - 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).186. **Min SDK:** Ensure `minSdk` is at least **25**.197. **Sample extraction mandate**: Wear Compose libraries ship with an additional JAR file which contains individual samples for each and every component. You mustn't propose code changes, other than previews or basic changes such as color changes, until the samples in Capability 3 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.2021## Gotchas22231. **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.242. **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.2526## Capabilities and tools2728### Capability 1: Migration2930Use this guidance when migrating from an older version of Wear OS Compose or31Horologist.32331. Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from `{VERSION}`.342. Read the [migration guide](references/android/training/wearables/compose/migrate-to-material3.md).353. Use the official component mappings from the migration guide.364. Before refactoring any component (for example, `Chip` -\> `Button`), check the parameter names, slot types, and "Expressive" design tokens.375. Do not use the Horologist Composables, Compose Layout, or Compose Material libraries.386. **Always** check against the component guidance in Capability 4.397. 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.4041### Capability 2: Adding Wear OS Compose Material3 features or updating the app4243Use this guidance when the developer asks to update a project which is using an44earlier version of Wear OS Compose Material3, or when they ask to add further45features.46471. Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from `{VERSION}`.482. Do not use the Horologist Composables, Compose Layout, or Compose Material libraries.493. **Always** check against the component guidance in Capability 4.504. 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.5152### Capability 3: Component samples5354Wear Compose includes individual component samples for each and every component,55within the `<artifact>-<version>-samples-sources.jar` file. Gradle automatically56downloads these JAR files along with the main library JAR when using any of57`compose-material3`, `compose-foundation` or `compose-navigation3`.5859Use the canonical component samples whenever adding or adjusting a Wear Compose60Material3 component.6162STRICT COMPLIANCE: Extraction is NOT optional. You are FORBIDDEN from63implementing any code until samples are extracted and read. Bypassing this step64with alternative search tools or by assuming library documentation is sufficient65is a protocol breach. You MUST verify the local cache by reading a sample file66before proceeding.6768Exception: You don't need to extract samples if the request is strictly related69to tooling (for example, adding @WearPreviewDevices), updating text/colors, or70basic refactoring that doesn't involve adding new Wear Compose components.7172#### Step 1: Prepare73741. Check the `build.gradle.kts` or `libs.versions.toml` to ensure the Wear Compose version matches `{VERSION}`.752. Ensure that the necessary dependencies are downloaded by doing a Gradle sync.7677#### Step 2: Check the local cache78791. Define the cache directory path: `/tmp/wear-compose-samples/{VERSION}/`. Do NOT choose your own different location.802. Check if this directory exists and contains subdirectories with `.kt` files.81 - **IF YES (cache hit):** Proceed to **Step 4**.82 - **IF NO (cache miss):** Proceed to **Step 3**.8384#### Step 3: Network-based sample retrieval8586Google Maven publishes a `-samples-sources.jar` alongside every library release.87Download and extract it directly without needing a local Gradle sync or cache88lookup.89901. Determine the `{VERSION}` of `androidx.wear.compose:compose-material3` from `build.gradle.kts` or `libs.versions.toml`.912. Define `{ARTIFACT}` as the items in the list `["material3", "foundation"]`. Also include `navigation3` if `androidx.wear.compose.navigation3` is used.923. For each `{ARTIFACT}`, run the following commands to download and extract93 the samples:9495 # Download the samples-sources JAR96 curl -sSL "https://dl.google.com/dl/android/maven2/androidx/wear/compose/compose-{ARTIFACT}/{VERSION}/compose-{ARTIFACT}-{VERSION}-samples-sources.jar" -o {ARTIFACT}-{VERSION}-samples.jar9798 # Extract and flatten into the cache directory99 unzip -q -o {ARTIFACT}-{VERSION}-samples.jar -d /tmp/wear-compose-samples/{VERSION}/{ARTIFACT}/100101 # Clean up102 rm {ARTIFACT}-{VERSION}-samples.jar1031044. If this works, proceed directly to step 4.105106#### Step 4: Read samples and implement1071081. Read the relevant `.kt` sample files.1092. Use these official, version-matched samples as the source of truth for:110 - Required parameters and slot names.111 - Default styling and typography tokens.112 - Interactive behaviors (for example: `onClick`, `onLongClick`).113 - Component nesting (for example: `AppScaffold` -\> `ScreenScaffold`).114115### Capability 4: Component guidance116117**Mandatory**: Use this capability as a checklist against any component use. It118provides more holistic guidance on how to use each component in practice, beyond119the component syntax.1201211. `AppScaffold` and `ScreenScaffold`122 - \[ \] Use `AppScaffold` as the outer container, with `ScreenScaffold` children.123 - \[ \] Use only **ONE** `AppScaffold` and any number of `ScreenScaffold`.1242. `ScalingLazyColumn` - Use `TransformingLazyColumn` instead.1253. `TransformingLazyColumn` - You will need the following imports:126127128 ```kotlin129 import androidx.wear.compose.foundation.lazy.TransformingLazyColumn130 import androidx.wear.compose.foundation.lazy.TransformingLazyColumnDefaults131 import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState132 // ...133 import androidx.wear.compose.material3.lazy.rememberTransformationSpec134 import androidx.wear.compose.material3.lazy.transformedHeight135 ```136137 <br />138139 **Canonical example**:140141142 ```kotlin143 val columnState = rememberTransformingLazyColumnState()144 val transformationSpec = rememberTransformationSpec()145 ScreenScaffold(146 scrollState = columnState147 ) { contentPadding ->148 TransformingLazyColumn(149 state = columnState,150 contentPadding = contentPadding151 ) {152 item {153 ListHeader(154 modifier = Modifier155 .fillMaxWidth()156 .transformedHeight(this, transformationSpec)157 .minimumVerticalContentPadding(ListHeaderDefaults.minimumTopListContentPadding),158 transformation = SurfaceTransformation(transformationSpec)159 ) {160 Text(text = "Header")161 }162 }163 // ... other items164 item {165 Button(166 modifier = Modifier167 .fillMaxWidth()168 .transformedHeight(this, transformationSpec)169 .minimumVerticalContentPadding(ButtonDefaults.minimumVerticalListContentPadding),170 transformation = SurfaceTransformation(transformationSpec),171 onClick = { /* ... */ },172 icon = {173 Icon(174 imageVector = Icons.Default.Build,175 contentDescription = "build",176 )177 },178 ) {179 Text(180 text = "Build",181 maxLines = 1,182 overflow = TextOverflow.Ellipsis,183 )184 }185 }186 }187 }188 ```189190 <br />191192 - \[ \] Use `TransformingLazyColumn` instead of `ScalingLazyColumn`.193 - \[ \] You must pass the `contentPadding` parameter from `ScreenScaffold` to the `TransformingLazyColumn`.194 - \[ \] Use the `minimumVerticalContentPadding` modifier to achieve required padding top and bottom.195 - This expects a value from defaults, such as `ButtonDefaults`, `CardDefaults`, \`ListHeaderDefaults.196 - Note: This is a scoped modifier available within `TransformingLazyColumnItemScope`.197 - \[ \] Ensure the list morphs and scales.198 - \[ \] Use `transformedHeight` modifier.199 - \[ \] Use `transform = SurfaceTransform(...)`.200 - \[ \] If configuring a list for snapping, use `flingBehavior` and `rotaryScrollableBehavior` **together**:201202203 ```kotlin204 val columnState = rememberTransformingLazyColumnState()205 ScreenScaffold(scrollState = columnState) { contentPadding ->206 TransformingLazyColumn(207 state = columnState,208 flingBehavior = TransformingLazyColumnDefaults.snapFlingBehavior(columnState),209 rotaryScrollableBehavior = RotaryScrollableDefaults.snapBehavior(columnState)210 ) {211 // ...212 // ...213 }214 }215 ```216217 <br />2182194. `ScreenScaffold`220221 - \[ \] Guard the `scrollIndicator` with `!LocalScrollCaptureInProgress.current`.2225. `EdgeButton`223224 - \[ \] Do **NOT** use as the final item within a `TransformingLazyColumn`. Instead, use the slot in `ScreenScaffold`.225 - \[ \] When used in a `TransformingLazyColumn`, add the required overscroll behavior:226227228 ```kotlin229 val columnState = rememberTransformingLazyColumnState()230 ScreenScaffold(231 scrollState = columnState,232 edgeButton = {233 EdgeButton(234 onClick = { /* TODO */ },235 modifier = Modifier.scrollable(236 columnState,237 orientation = Orientation.Vertical,238 reverseDirection = true,239 // Apply overscroll to the EdgeButton for proper scrolling behavior.240 overscrollEffect = rememberOverscrollEffect(),241 )242 ) {243 Text("More")244 }245 }246 ) { contentPadding ->247 TransformingLazyColumn(248 contentPadding = contentPadding,249 state = columnState,250 ) {251 // ...252 // ...253 }254 }255 ```256257 <br />2582596. `Column`260261 - \[ \] USE as a direct child of `ScreenScaffold` *if* the screen is will **never** scroll, even with the largest system font.262 - \[ \] Use `TransformingLazyColumn` instead for all other cases.2637. Styles264265 - \[ \] Do **NOT** hard-code text sizes, use `typography` from `MaterialTheme`.266 - \[ \] Do **NOT** hard-code colors, use `colorScheme` from `MaterialTheme`.2678. Use component defaults:268269 - \[ \] Components such as `Button` have a corresponding `ButtonDefaults` object.270 - \[ \] Check for and use the `*Defaults` object for any component when working with padding and styling values, in preference to hard-coded values.2719. Use Wear specific previews:272273 - \[ \] `WearPreviewDevices`274 - \[ \] `WearPreviewFontScales`27510. Ambient mode276277 - \[ \] Use `LocalAmbientModeManager` instead of `AmbientLifecycleObserver`.27811. Navigation279280 - \[ \] When adding navigation fresh, use Navigation3.281 - \[ \] For Navigation3 in Wear OS, use `SwipeDismissableSceneStrategy()` from the Wear Compose `compose-navigation3` library.28212. Comments283284 - \[ \] Where any Kotlin file has been modified, ensure that the existing comments are up to date and accurately reflect any changes to the implementation.28513. `HorizontalPager` or `VerticalPager`286287 - \[ \] Use the Composable hierarchy in this order: `AppScaffold`, `HorizontalPagerScaffold`, `HorizontalPager`, `AnimatedPage`, `ScreenScaffold`. Or similarly for `VerticalPager`.