Skip to content

Commit ecd17ad

Browse files
committed
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. (cherry picked from commit c10b5fe)
1 parent 033028b commit ecd17ad

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
@@ -10,6 +10,7 @@
1010
@function get-unthemable-tokens() {
1111
@return (
1212
icon-button-icon-size: 24px,
13+
icon-button-container-shape: 50%,
1314
);
1415
}
1516

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)