class Typography


Class holding typography definitions as defined by the Wear Material typography specification.

The text styles in this typography are scaled according to the user's preferred font size in the system settings. Larger font sizes can be fixed if necessary in order to avoid pressure on screen space, because they are already sufficiently accessible. Here is an example of fixing the font size for DisplayLarge:

import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.Text

val typography = MaterialTheme.typography.copy(
    displayLarge = MaterialTheme.typography.displayLarge.copy(
        fontSize = with(LocalDensity.current) { 40.dp.toSp() }
    )
)
MaterialTheme(typography = typography) {
    Text(
        text = "Fixed Font",
        maxLines = 1,
        style = MaterialTheme.typography.displayLarge,
        color = MaterialTheme.colorScheme.onBackground,
    )
}

TODO(b/273526150) Review documentation for typography, add examples for each size.

Summary

Public constructors

Typography(
    defaultFontFamily: FontFamily,
    displayLarge: TextStyle,
    displayMedium: TextStyle,
    displaySmall: TextStyle,
    titleLarge: TextStyle,
    titleMedium: TextStyle,
    titleSmall: TextStyle,
    labelLarge: TextStyle,
    labelMedium: TextStyle,
    labelSmall: TextStyle,
    bodyLarge: TextStyle,
    bodyMedium: TextStyle,
    bodySmall: TextStyle,
    bodyExtraSmall: TextStyle
)

Public functions

Typography
copy(
    displayLarge: TextStyle,
    displayMedium: TextStyle,
    displaySmall: TextStyle,
    titleLarge: TextStyle,
    titleMedium: TextStyle,
    titleSmall: TextStyle,
    labelLarge: TextStyle,
    labelMedium: TextStyle,
    labelSmall: TextStyle,
    bodyLarge: TextStyle,
    bodyMedium: TextStyle,
    bodySmall: TextStyle,
    bodyExtraSmall: TextStyle
)

Returns a copy of this Typography, optionally overriding some of the values.

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

TextStyle

BodyExtraSmall is the smallest body.

TextStyle

BodyLarge is the largest body.

TextStyle

BodyMedium is second largest body.

TextStyle

BodySmall is third largest body.

TextStyle

DisplayLarge is the largest headline.

TextStyle

DisplayMedium is the second largest headline.

TextStyle

DisplaySmall is the smallest headline.

TextStyle

LabelLarge is the largest label.

TextStyle

LabelMedium is the medium label.

TextStyle

LabelSmall is the small label.

TextStyle

TitleLarge is the largest title.

TextStyle

TitleMedium is the medium title.

TextStyle

TitleSmall is the smallest title.

Public constructors

Typography

Added in 1.0.0-alpha21
Typography(
    defaultFontFamily: FontFamily = FontFamily.Default,
    displayLarge: TextStyle = TypographyTokens.DisplayLarge,
    displayMedium: TextStyle = TypographyTokens.DisplayMedium,
    displaySmall: TextStyle = TypographyTokens.DisplaySmall,
    titleLarge: TextStyle = TypographyTokens.TitleLarge,
    titleMedium: TextStyle = TypographyTokens.TitleMedium,
    titleSmall: TextStyle = TypographyTokens.TitleSmall,
    labelLarge: TextStyle = TypographyTokens.LabelLarge,
    labelMedium: TextStyle = TypographyTokens.LabelMedium,
    labelSmall: TextStyle = TypographyTokens.LabelSmall,
    bodyLarge: TextStyle = TypographyTokens.BodyLarge,
    bodyMedium: TextStyle = TypographyTokens.BodyMedium,
    bodySmall: TextStyle = TypographyTokens.BodySmall,
    bodyExtraSmall: TextStyle = TypographyTokens.BodyExtraSmall
)

Public functions

copy

Added in 1.0.0-alpha21
fun copy(
    displayLarge: TextStyle = this.displayLarge,
    displayMedium: TextStyle = this.displayMedium,
    displaySmall: TextStyle = this.displaySmall,
    titleLarge: TextStyle = this.titleLarge,
    titleMedium: TextStyle = this.titleMedium,
    titleSmall: TextStyle = this.titleSmall,
    labelLarge: TextStyle = this.labelLarge,
    labelMedium: TextStyle = this.labelMedium,
    labelSmall: TextStyle = this.labelSmall,
    bodyLarge: TextStyle = this.bodyLarge,
    bodyMedium: TextStyle = this.bodyMedium,
    bodySmall: TextStyle = this.bodySmall,
    bodyExtraSmall: TextStyle = this.bodyExtraSmall
): Typography

Returns a copy of this Typography, optionally overriding some of the values.

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

bodyExtraSmall

Added in 1.0.0-alpha21
val bodyExtraSmallTextStyle

BodyExtraSmall is the smallest body. Body texts are typically used for long-form writing as it works well for small text sizes. For longer sections of text, a serif or sans serif typeface is recommended.

bodyLarge

Added in 1.0.0-alpha21
val bodyLargeTextStyle

BodyLarge is the largest body. Body texts are typically used for long-form writing as it works well for small text sizes. For longer sections of text, a serif or sans serif typeface is recommended.

bodyMedium

Added in 1.0.0-alpha21
val bodyMediumTextStyle

BodyMedium is second largest body. Body texts are typically used for long-form writing as it works well for small text sizes. For longer sections of text, a serif or sans serif typeface is recommended.

bodySmall

Added in 1.0.0-alpha21
val bodySmallTextStyle

BodySmall is third largest body. Body texts are typically used for long-form writing as it works well for small text sizes. For longer sections of text, a serif or sans serif typeface is recommended.

displayLarge

Added in 1.0.0-alpha21
val displayLargeTextStyle

DisplayLarge is the largest headline. Displays are the largest text on the screen, reserved for short, important text or numerals.

displayMedium

Added in 1.0.0-alpha21
val displayMediumTextStyle

DisplayMedium is the second largest headline. Displays are the largest text on the screen, reserved for short, important text or numerals.

displaySmall

Added in 1.0.0-alpha21
val displaySmallTextStyle

DisplaySmall is the smallest headline. Displays are the largest text on the screen, reserved for short, important text or numerals.

labelLarge

Added in 1.0.0-alpha21
val labelLargeTextStyle

LabelLarge is the largest label. They are used for displaying prominent texts like label on title buttons.

labelMedium

Added in 1.0.0-alpha21
val labelMediumTextStyle

LabelMedium is the medium label. They are used for displaying texts like primary label on buttons.

labelSmall

Added in 1.0.0-alpha21
val labelSmallTextStyle

LabelSmall is the small label. They are used for displaying texts like secondary label on buttons, labels on compact buttons.

titleLarge

Added in 1.0.0-alpha21
val titleLargeTextStyle

TitleLarge is the largest title. Titles are smaller than Displays. They are typically reserved for medium-emphasis text that is shorter in length.

titleMedium

Added in 1.0.0-alpha21
val titleMediumTextStyle

TitleMedium is the medium title. Titles are smaller than Displays. They are typically reserved for medium-emphasis text that is shorter in length.

titleSmall

Added in 1.0.0-alpha21
val titleSmallTextStyle

TitleSmall is the smallest title. Titles are smaller than Displays. They are typically reserved for medium-emphasis text that is shorter in length.