Google is committed to advancing racial equity for Black communities. See how.

Typography

@Immutable data class Typography
kotlin.Any
   ↳ androidx.compose.material.Typography

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

Summary

Public constructors
<init>(defaultFontFamily: FontFamily = FontFamily.Default, h1: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = 96.sp, letterSpacing = (-1.5).sp ), h2: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = 60.sp, letterSpacing = (-0.5).sp ), h3: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 48.sp, letterSpacing = 0.sp ), h4: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 34.sp, letterSpacing = 0.25.sp ), h5: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 24.sp, letterSpacing = 0.sp ), h6: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = 20.sp, letterSpacing = 0.15.sp ), subtitle1: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 16.sp, letterSpacing = 0.15.sp ), subtitle2: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = 14.sp, letterSpacing = 0.1.sp ), body1: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 16.sp, letterSpacing = 0.5.sp ), body2: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 14.sp, letterSpacing = 0.25.sp ), button: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = 14.sp, letterSpacing = 1.25.sp ), caption: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 12.sp, letterSpacing = 0.4.sp ), overline: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 10.sp, letterSpacing = 1.5.sp ))

Constructor to create a Typography.

Properties
TextStyle

body1 is the largest body, and is typically used for long-form writing as it works well for small text sizes.

TextStyle

body2 is the smallest body, and is typically used for long-form writing as it works well for small text sizes.

TextStyle

button text is a call to action used in different types of buttons (such as text, outlined and contained buttons) and in tabs, dialogs, and cards.

TextStyle

caption is one of the smallest font sizes.

TextStyle

h1 is the largest headline, reserved for short, important text or numerals.

TextStyle

h2 is the second largest headline, reserved for short, important text or numerals.

TextStyle

h3 is the third largest headline, reserved for short, important text or numerals.

TextStyle

h4 is the fourth largest headline, reserved for short, important text or numerals.

TextStyle

h5 is the fifth largest headline, reserved for short, important text or numerals.

TextStyle

h6 is the sixth largest headline, reserved for short, important text or numerals.

TextStyle

overline is one of the smallest font sizes.

TextStyle

subtitle1 is the largest subtitle, and is typically reserved for medium-emphasis text that is shorter in length.

TextStyle

subtitle2 is the smallest subtitle, and is typically reserved for medium-emphasis text that is shorter in length.

Public constructors

<init>

Typography(
    defaultFontFamily: FontFamily = FontFamily.Default,
    h1: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = 96.sp, letterSpacing = (-1.5).sp ),
    h2: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = 60.sp, letterSpacing = (-0.5).sp ),
    h3: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 48.sp, letterSpacing = 0.sp ),
    h4: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 34.sp, letterSpacing = 0.25.sp ),
    h5: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 24.sp, letterSpacing = 0.sp ),
    h6: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = 20.sp, letterSpacing = 0.15.sp ),
    subtitle1: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 16.sp, letterSpacing = 0.15.sp ),
    subtitle2: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = 14.sp, letterSpacing = 0.1.sp ),
    body1: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 16.sp, letterSpacing = 0.5.sp ),
    body2: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 14.sp, letterSpacing = 0.25.sp ),
    button: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = 14.sp, letterSpacing = 1.25.sp ),
    caption: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 12.sp, letterSpacing = 0.4.sp ),
    overline: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 10.sp, letterSpacing = 1.5.sp ))

Constructor to create a Typography. For information on the types of style defined in this constructor, see the property documentation for Typography.

Parameters
defaultFontFamily: FontFamily = FontFamily.Default the default FontFamily to be used for TextStyles provided in this constructor. This default will be used if the FontFamily on the TextStyle is null.
h1: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = 96.sp, letterSpacing = (-1.5).sp ) h1 is the largest headline, reserved for short, important text or numerals.
h2: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = 60.sp, letterSpacing = (-0.5).sp ) h2 is the second largest headline, reserved for short, important text or numerals.
h3: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 48.sp, letterSpacing = 0.sp ) h3 is the third largest headline, reserved for short, important text or numerals.
h4: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 34.sp, letterSpacing = 0.25.sp ) h4 is the fourth largest headline, reserved for short, important text or numerals.
h5: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 24.sp, letterSpacing = 0.sp ) h5 is the fifth largest headline, reserved for short, important text or numerals.