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

← Back to Material Compose

MaterialTheme

Component
in
Material
. Since 0.1.0-dev15

Overview

Code Examples

Video

<a href="https://material.io/design/material-theming/overview.html" class="external" target="_blank">Material Theming</a>.

Material Theming refers to the customization of your Material Design app to better reflect your product’s brand.

Material components such as Button and Checkbox use values provided here when retrieving default values.

It defines colors as specified in the Material Color theme creation spec(https://material.io/design/color/the-color-system.html#color-theme-creation), typography defined in the Material Type Scale spec(https://material.io/design/typography/the-type-system.html#type-scale), and shapes defined in the Shape scheme(https://material.io/design/shape/applying-shape-to-ui.html#shape-scheme).

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.

Overloads

MaterialTheme

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

Parameters

NameDescription
colorsA complete definition of the 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