Skip to content

Commit c10b5fe

Browse files
authored
fix(material/button): add token for icon button shape (#31223)
Fixes that it wasn't possible to customize the shape of the icon button using tokens. Fixes #30525.
1 parent f648004 commit c10b5fe

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/material/button/_m2-icon-button.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@function get-unthemable-tokens() {
1010
@return (
1111
icon-button-icon-size: 24px,
12+
icon-button-container-shape: 50%,
1213
);
1314
}
1415

src/material/button/_m3-icon-button.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
$tokens: (
2121
base: (
2222
icon-button-icon-size: 24px,
23+
icon-button-container-shape: map.get($system, corner-full),
2324
),
2425
color: (
2526
icon-button-disabled-icon-color:

src/material/button/icon-button.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $fallbacks: m3-icon-button.get-tokens();
2121
overflow: visible;
2222

2323
// Border radius is inherited by ripple to know its shape. Set to 50% so the ripple is round.
24-
border-radius: 50%;
24+
border-radius: token-utils.slot(icon-button-container-shape, $fallbacks, $fallback: 50%);
2525

2626
// Prevent the button from shrinking since it's always supposed to be a circle.
2727
flex-shrink: 0;
@@ -69,7 +69,7 @@ $fallbacks: m3-icon-button.get-tokens();
6969
}
7070

7171
.mat-mdc-button-persistent-ripple {
72-
border-radius: 50%;
72+
border-radius: token-utils.slot(icon-button-container-shape, $fallbacks, $fallback: 50%);
7373
}
7474

7575
// MDC used to include this and it seems like a lot of apps depend on it.

0 commit comments

Comments
 (0)