angular / angular/components

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

Open
#30,701 2 comments 1 reaction 0 assignees View on GitHub
area: theming docs P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Start at the theming guide's density section at material.angular.io/guide/theming#density and compare the documented example with the define-theme configuration shown in the issue. Update the outdated example so its density configuration matches the expected code, and check whether the typography example has the same problem. Done means the guide no longer shows configuration that produces the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, sass
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.