Skip to content

Commit d822f07

Browse files
authored
fix(badge): fix badge paddings when using projection content (#17190)
* 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 8d09187 commit d822f07

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

projects/igniteui-angular/badge/src/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/core/src/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(--ig-icon-size, #{sizable(rem(12px), rem(14px), rem(16px))});
@@ -56,7 +62,6 @@
5662

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

6267
%igx-badge--success {

0 commit comments

Comments
 (0)