Skip to content

Commit 28a06b9

Browse files
authored
fix(badge): fix badge paddings when using projection content (#17193)
* fix(badge): fix badge paddings when using projection content * fix(badge): fix badge paddings and update API docs * feat(badge): add gap between contents of badge
1 parent 30b6652 commit 28a06b9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

projects/igniteui-angular/src/lib/badge/badge.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export class IgxBadgeComponent {
7777
* Sets/gets the value to be displayed inside the badge.
7878
*
7979
* @remarks
80-
* If an `icon` property is already set the `icon` will be displayed.
8180
* If neither a `value` nor an `icon` is set the content of the badge will be empty.
8281
*
8382
* @example
@@ -92,7 +91,6 @@ export class IgxBadgeComponent {
9291
* Sets/gets an icon for the badge from the material icons set.
9392
*
9493
* @remarks
95-
* Has priority over the `value` property.
9694
* If neither a `value` nor an `icon` is set the content of the badge will be empty.
9795
* Providing an invalid value won't display anything.
9896
*

projects/igniteui-angular/src/lib/core/styles/components/badge/_badge-theme.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
border-radius: calc(var(--size) / 2);
2727
box-shadow: var-get($theme, 'elevation');
2828
overflow: hidden;
29+
padding-inline: pad-inline(rem(4px), rem(6px), if($variant == 'indigo', rem(6px), rem(8px)));
30+
gap: rem(2px);
31+
32+
&:has(igx-icon:only-child) {
33+
padding-inline: 0;
34+
}
2935

3036
igx-icon {
3137
--size: var(--igx-icon-size, #{sizable(rem(12px), rem(14px), rem(16px))});
@@ -57,7 +63,6 @@
5763

5864
%igx-badge-value {
5965
white-space: nowrap;
60-
padding-inline: pad-inline(rem(4px), rem(6px), if($variant == 'indigo', rem(6px), rem(8px)));
6166
}
6267

6368
%igx-badge--success {

0 commit comments

Comments
 (0)