Skip to content

MDC button density is overridden by base button styles #22728

Closed
@jelbourn

Description

@jelbourn

The MDC button's button.scss file emits the following style:

.mdc-button {
  height: 36px;
  border-radius: 4px;
  border-radius: var(--mdc-shape-small, 4px);
  padding: 0 8px 0 8px
}

When applying button density via theme mixin, the correct height is emitted into the theme (density -2 here):

.mat-mdc-button, 
.mat-mdc-raised-button, 
.mat-mdc-unelevated-button, 
.mat-mdc-outlined-button {
  height: 28px;
  margin-top: 0;
  margin-bottom: 0
}

In the vast majority of cases, people will include their theme file in the document head. Angular, however, will append component-specific styles at the end of the head, meaning that the button's base styles will take precedence over the theme style.

Metadata

Metadata

Assignees

Labels

GThis is is related to a Google internal issueP2The issue is important to a large percentage of users, with a workaroundarea: material/button

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions