State of Compose 2023 results are in! Click here to learn more

← Back to Wear Material

MaterialTheme

Component
in
Wear Material
. Since 1.0.0

Overview

Code Examples

Video

MaterialTheme defines the styling principles from the WearOS Material design specification which extends the Material design specification.

Wear Material components from package/sub-packages in androidx.wear.compose.material use values provided here when retrieving default values.

It defines colors as specified in the Wear Material Color theme spec(https://developer.android.com/training/wearables/components/theme#color), typography defined in the Wear Material Type Scale spec(https://developer.android.com/training/wearables/components/theme#typography), and shapes defined in the Wear Shape scheme(https://).

All values may be set by providing this component with the colorsColors, typographyTypography, and shapesShapes attributes. Use this to configure the overall theme of elements within this MaterialTheme.

Any values that are not set will inherit the current value from the theme, falling back to the defaults if there is no parent MaterialTheme. This allows using a MaterialTheme at the top of your application, and then separate MaterialTheme(s) for different screens / parts of your UI, overriding only the parts of the theme definition that need to change.

For more information, see the Theming(https://developer.android.com/training/wearables/components/theme) guide.

@param colors A complete definition of the Wear Material Color theme for this hierarchy @param typography A set of text styles to be used as this hierarchy's typography system @param shapes A set of shapes to be used by the components in this hierarchy

Overloads

MaterialTheme

@Composable
public fun MaterialTheme(
    colors: Colors = MaterialTheme.colors,
    typography: Typography = MaterialTheme.typography,
    shapes: Shapes = MaterialTheme.shapes,
    content: @Composable () -> Unit
)

Parameters

NameDescription
colorsA complete definition of the Wear Material Color theme for this hierarchy
typographyA set of text styles to be used as this hierarchy's typography system
shapesA set of shapes to be used by the components in this hierarch