Skip to content

docs-bug(theming): Example with define-theme is outdated #30701

Open
@mrmokwa

Description

@mrmokwa

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Documentation about define-theme seems to be outdated.

@use '@angular/material' as mat;

html {
  @include mat.theme((
    color: mat.$violet-palette,
    typography: Roboto,
    density: -2,
  ));
}

Reproduction

You can check at:

https://material.angular.io/guide/theming#density

Expected Behavior

The corret code should be:

$theme: mat.define-theme(
  (
    color: (
      primary: mat.$azure-palette,
      tertiary: mat.$violet-palette,
      theme-type: light,
    ),
    density: (
      scale: -2,
    ),
  )
);

Actual Behavior

This code results in the following error:

$config.density should be a density configuration object.

I believe this error also occours with typography config.

Environment

  • Angular: 19
  • CDK/Material: 19

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: themingdocsThis issue is related to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions