Prerequisites & 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.
- Otherwise, fetch the official Maven metadata XML to identify
{VERSION} (highest number, ignoring -alpha, -beta, or -rc)
- 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
files are incomplete and NOT a substitute for these samples; bypassing
extraction is an environment setup failure.
Gotchas
- Mandatory Sync & 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 (e.g.,
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 for:
- Required parameters and slot names.
- Default styling and typography tokens.
- Interactive behaviors (e.g.,
onClick, onLongClick).
- Component nesting (e.g.,
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 \& 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`)11 1. **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.122. **Kotlin Version:** For Wear Compose Material3, use Kotlin **2.0.0 or13 higher**.143. **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 Compatibility17 Map](https://developer.android.com/jetpack/androidx/releases/compose-kotlin).18 1. **Min SDK:** Ensure `minSdk` is at least **25** (Wear OS 2.0).194. **Sample Extraction Mandate**: Wear Compose libraries ship with an20 additional JAR file which contains individual samples for each and every21 component. You MUST NOT propose code changes until the samples in Capability2223 files are incomplete and NOT a substitute for these samples; bypassing24 extraction is an environment setup failure.2526## Gotchas27281. **Mandatory Sync \& 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.292. **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.3031## Capabilities and Tools3233### Capability 1: Migration3435Use this guidance when migrating from an older version of Wear OS Compose or36Horologist.37381. Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from `{VERSION}`.392. Read the [migration guide](references/android/training/wearables/compose/migrate-to-material3.md)403. Use the official component mappings from the migration guide.414. Before refactoring any component (e.g., `Chip` -\> `Button`), check the parameter names, slot types, and "Expressive" design tokens.425. Do not use the Horologist Composables, Compose Layout, or Compose Material libraries.436. **Always** check against the component guidance in Capability #3.447. 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.4546### Capability 2: Component samples4748Wear Compose includes individual component samples for each and every component,49within the `<artifact>-<version>-samples-sources.jar` file. Gradle automatically50downloads these JAR files along with the main library JAR when using any of51`compose-material3`, `compose-foundation` or `compose-navigation3`.5253Use the canonical component samples whenever adding or adjusting a Wear Compose54Material3 component.5556STRICT COMPLIANCE: Extraction is NOT optional. You are FORBIDDEN from57implementing any code until samples are extracted and read. Bypassing this step58with alternative search tools or by assuming library documentation is sufficient59is a protocol breach. You MUST verify the local cache by reading a sample file60before proceeding.6162#### Step 1: Prepare63641. Check the `build.gradle.kts` or `libs.versions.toml` to ensure the Wear Compose version matches `{VERSION}`.652. Ensure that the necessary dependencies are downloaded by doing a Gradle sync.6667#### Step 2: Check the Local Cache68691. Define the cache directory path: `<SKILL_ROOT>/samples/{VERSION}/`. Do NOT choose your own different location.702. Check if this directory exists and contains subdirectories with `.kt` files.71 - **IF YES (Cache Hit):** Proceed to **Step 4**.72 - **IF NO (Cache Miss):** Proceed to **Step 3**.7374#### Step 3: Check the Gradle Cache75761. Sample sources are stored in the Gradle cache. To avoid slow, brute-force searches:77 - Determine the Gradle User Home (usually `~/.gradle`, or check `$GRADLE_USER_HOME`).78 - The cache root is `<GRADLE_USER_HOME>/caches`. Call this `<CACHE_ROOT>`.792. 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.803. For each `{ARTIFACT}` in the list:8182 - Construct the expected relative path segment for the library: `androidx.wear.compose/compose-{ARTIFACT}/{VERSION}`.83 - Run a targeted `find` command. Here is an example which is constructed84 for efficiency:8586 find <CACHE_ROOT>/modules-2/files-2.1/androidx.wear.compose/compose-{ARTIFACT}/{VERSION}/ \87 -name "*samples-sources.jar"88894. Use this JAR as the official sample sources.90915. Extract the contents of each JAR to92 `<SKILL_ROOT>/samples/{VERSION}/{ARTIFACT}/` using `unzip -j` to flatten the93 structure.94956. Proceed **directly to step 4**.9697#### Step 4: Read Samples and Implement98991. Read the relevant `.kt` sample files.1002. Use these official, version-matched samples as the for:101 - Required parameters and slot names.102 - Default styling and typography tokens.103 - Interactive behaviors (e.g., `onClick`, `onLongClick`).104 - Component nesting (e.g., `AppScaffold` -\> `ScreenScaffold`).105106### Capability 3: Component guidance107108**Mandatory**: Use this capability as a checklist against any component use. It109provides more holistic guidance on how to use each component in practice, beyond110the component syntax.1111121. `AppScaffold` and `ScreenScaffold`113 - \[ \] Use `AppScaffold` as the outer container, with `ScreenScaffold` children.114 - \[ \] Use only **ONE** `AppScaffold` and any number of `ScreenScaffold`.1152. `ScalingLazyColumn` - Use `TransformingLazyColumn` instead.1163. `TransformingLazyColumn`117118 You will need the following imports:119120121 ```kotlin122 import androidx.wear.compose.foundation.lazy.TransformingLazyColumn123 import androidx.wear.compose.foundation.lazy.TransformingLazyColumnDefaults124 import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState125 // ...126 import androidx.wear.compose.material3.lazy.rememberTransformationSpec127 import androidx.wear.compose.material3.lazy.transformedHeight128 ```129130 <br />131132 **Canonical example**:133134135 ```kotlin136 val columnState = rememberTransformingLazyColumnState()137 val transformationSpec = rememberTransformationSpec()138 ScreenScaffold(139 scrollState = columnState140 ) { contentPadding ->141 TransformingLazyColumn(142 state = columnState,143 contentPadding = contentPadding144 ) {145 item {146 ListHeader(147 modifier = Modifier148 .fillMaxWidth()149 .transformedHeight(this, transformationSpec)150 .minimumVerticalContentPadding(ListHeaderDefaults.minimumTopListContentPadding),151 transformation = SurfaceTransformation(transformationSpec)152 ) {153 Text(text = "Header")154 }155 }156 // ... other items157 item {158 Button(159 modifier = Modifier160 .fillMaxWidth()161 .transformedHeight(this, transformationSpec)162 .minimumVerticalContentPadding(ButtonDefaults.minimumVerticalListContentPadding),163 transformation = SurfaceTransformation(transformationSpec),164 onClick = { /* ... */ },165 icon = {166 Icon(167 imageVector = Icons.Default.Build,168 contentDescription = "build",169 )170 },171 ) {172 Text(173 text = "Build",174 maxLines = 1,175 overflow = TextOverflow.Ellipsis,176 )177 }178 }179 }180 }181 ```182183 <br />184185 - \[ \] Use `TransformingLazyColumn` instead of `ScalingLazyColumn`186 - \[ \] You must pass the `contentPadding` parameter from `ScreenScaffold` to the `TransformingLazyColumn`.187 - \[ \] Use the `minimumVerticalContentPadding` modifier to achieve required padding top and bottom.188 - This expects a value from defaults, such as `ButtonDefaults`, `CardDefaults`, \`ListHeaderDefaults.189 - Note: This is a scoped modifier available within `TransformingLazyColumnItemScope`.190 - \[ \] Ensure the list morphs and scales.191 - \[ \] Use `transformedHeight` modifier.192 - \[ \] Use `transform = SurfaceTransform(...)`.193 - \[ \] If configuring a list for snapping, use `flingBehavior` and `rotaryScrollableBehavior` **together**:194195196 ```kotlin197 val columnState = rememberTransformingLazyColumnState()198 ScreenScaffold(scrollState = columnState) { contentPadding ->199 TransformingLazyColumn(200 state = columnState,201 flingBehavior = TransformingLazyColumnDefaults.snapFlingBehavior(columnState),202 rotaryScrollableBehavior = RotaryScrollableDefaults.snapBehavior(columnState)203 ) {204 // ...205 // ...206 }207 }208 ```209210 <br />2112124. `ScreenScaffold`213214 - \[ \] Guard the `scrollIndicator` with `!LocalScrollCaptureInProgress.current`2155. `EdgeButton`216217 - \[ \] Do **NOT** use as the final item within a `TransformingLazyColumn`. Instead, use the slot in `ScreenScaffold`.218 - \[ \] When used in a `TransformingLazyColumn`, add the required overscroll behavior:219220221 ```kotlin222 val columnState = rememberTransformingLazyColumnState()223 ScreenScaffold(224 scrollState = columnState,225 edgeButton = {226 EdgeButton(227 onClick = { /* TODO */ },228 modifier = Modifier.scrollable(229 columnState,230 orientation = Orientation.Vertical,231 reverseDirection = true,232 // Apply overscroll to the EdgeButton for proper scrolling behavior.233 overscrollEffect = rememberOverscrollEffect(),234 )235 ) {236 Text("More")237 }238 }239 ) { contentPadding ->240 TransformingLazyColumn(241 contentPadding = contentPadding,242 state = columnState,243 ) {244 // ...245 // ...246 }247 }248 ```249250 <br />2512526. `Column`253254 - \[ \] USE as a direct child of `ScreenScaffold` *if* the screen is will **never** scroll, even with the largest system font.255 - \[ \] Use `TransformingLazyColumn` instead for all other cases.2567. Styles257258 - \[ \] Do **NOT** hard-code text sizes, use `typography` from `MaterialTheme`.259 - \[ \] Do **NOT** hard-code colors, use `colorScheme` from `MaterialTheme`.2608. Use component defaults261262 - \[ \] Components such as `Button` have a corresponding `ButtonDefaults` object.263 - Check for and use the `*Defaults` object for any component when working with padding and styling values, in preference to hard-coded values.2649. Use Wear specific previews265266 - \[ \] `WearPreviewDevices`267 - \[ \] `WearPreviewFontScales`26810. Ambient mode269270 - \[ \] Use `LocalAmbientModeManager` instead of `AmbientLifecycleObserver`.27111. Navigation272273 - \[ \] When adding navigation fresh, use Navigation3.274 - \[ \] For Navigation3 in Wear OS, use `SwipeDismissableSceneStrategy()` from the Wear Compose `compose-navigation3` library.