Skip to content

Commit 5815013

Browse files
fix icon sizes inside badge
1 parent 7e9bd2c commit 5815013

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ ion-badge,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secon
317317
ion-badge,prop,hue,"bold" | "subtle" | undefined,undefined,false,false
318318
ion-badge,prop,mode,"ios" | "md",undefined,false,false
319319
ion-badge,prop,shape,"round | rectangular" | "soft" | undefined,undefined,false,false
320-
ion-badge,prop,size,"medium" | "small" | undefined,undefined,false,false
320+
ion-badge,prop,size,"large" | "medium" | "small" | undefined,undefined,false,false
321321
ion-badge,prop,theme,"ios" | "md" | "ionic",undefined,false,false
322322
ion-badge,prop,vertical,"bottom" | "top" | undefined,undefined,false,false
323323
ion-badge,css-prop,--background,ionic

core/src/components.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ export namespace Components {
442442
*/
443443
"shape"?: 'soft' | 'round | rectangular';
444444
/**
445-
* Set to `"small"` for a small badge. Set to "medium" for a medium badge. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
445+
* Set to `"small"` for a small badge. Set to `"medium"` for a medium badge. Set to `"large"` for a large badge, when it is empty (no text or icon). Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
446446
*/
447-
"size"?: 'small' | 'medium';
447+
"size"?: 'small' | 'medium' | 'large';
448448
/**
449449
* The theme determines the visual appearance of the component.
450450
*/
@@ -5899,9 +5899,9 @@ declare namespace LocalJSX {
58995899
*/
59005900
"shape"?: 'soft' | 'round | rectangular';
59015901
/**
5902-
* Set to `"small"` for a small badge. Set to "medium" for a medium badge. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
5902+
* Set to `"small"` for a small badge. Set to `"medium"` for a medium badge. Set to `"large"` for a large badge, when it is empty (no text or icon). Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
59035903
*/
5904-
"size"?: 'small' | 'medium';
5904+
"size"?: 'small' | 'medium' | 'large';
59055905
/**
59065906
* The theme determines the visual appearance of the component.
59075907
*/

core/src/components/badge/badge.ionic.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@
140140
transform: translate(-50%, -50%);
141141
}
142142

143+
:host(.badge-small) ::slotted(ion-icon) {
144+
width: globals.$ion-scale-300;
145+
height: globals.$ion-scale-300;
146+
}
147+
148+
:host(.badge-medium) ::slotted(ion-icon) {
149+
width: globals.$ion-scale-400;
150+
height: globals.$ion-scale-400;
151+
}
152+
143153
// Badge in Button
144154
// --------------------------------------------------
145155

core/src/components/badge/badge.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ export class Badge implements ComponentInterface {
4747

4848
/**
4949
* Set to `"small"` for a small badge.
50-
* Set to "medium" for a medium badge.
50+
* Set to `"medium"` for a medium badge.
51+
* Set to `"large"` for a large badge, when it is empty (no text or icon).
5152
*
5253
* Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
5354
*/
54-
@Prop() size?: 'small' | 'medium';
55+
@Prop() size?: 'small' | 'medium' | 'large';
5556

5657
/**
5758
* Set to `"top"` to position the badge on top right absolute position of the parent element.

0 commit comments

Comments
 (0)