Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material-experimental/mdc-chips): make it easier to customize chip typography #24632

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/material-experimental/mdc-chips/_chips-theme.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@use '@material/chips/chip' as mdc-chip;
@use '@material/chips/chip-theme' as mdc-chip-theme;
@use '@material/chips/chip-set' as mdc-chip-set;
@use '@material/theme/theme-color' as mdc-theme-color;
@use '@material/theme/color-palette' as mdc-color-palette;
@use '@material/typography' as mdc-typography;
@use 'sass:color';
@use 'sass:map';
@use '../mdc-helpers/mdc-helpers';
Expand Down Expand Up @@ -80,7 +80,12 @@
theming.get-typography-config($config-or-theme));
@include mdc-chip-set.core-styles($query: mdc-helpers.$mat-typography-styles-query);
@include mdc-helpers.mat-using-mdc-typography($config) {
@include mdc-chip.without-ripple-styles($query: mdc-helpers.$mat-typography-styles-query);
// Note that we don't go through MDC's typography mixin, because it assigns the styles to
// an inner element which makes it difficult for clients to customize. Instead we apply the
// same styles ourselves to the root.
.mat-mdc-standard-chip {
@include mdc-typography.typography(body2, $query: mdc-helpers.$mat-typography-styles-query);
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/material-experimental/mdc-chips/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
width: 100%;
}

// This element can be placed on a `button` node which usually has some user agent styles.
// Reset the font so that the typography from the root element can propagate down.
.mdc-evolution-chip__action--primary {
font: inherit;
letter-spacing: inherit;
white-space: inherit;
}

// MDC sizes and positions this element using `width`, `height` and `padding`.
// This usually works, but it's common for apps to add `box-sizing: border-box`
// to all elements on the page which can cause the graphic to be clipped.
Expand Down