Skip to content

Commit e593071

Browse files
feat(badge): update badge example and styles for avatar integration
1 parent b7177e0 commit e593071

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export type IgxBadgeType = (typeof IgxBadgeType)[keyof typeof IgxBadgeType];
3232
*
3333
* @example
3434
* ```html
35-
* <igx-avatar>
36-
* <igx-badge icon="check" type="success"></igx-badge>
37-
* </igx-avatar>
35+
* <div class="avatar-badge-container">
36+
* <igx-avatar icon="person" shape="circle" size="small"></igx-avatar>
37+
* <igx-badge icon="check" type="success" shape="square"></igx-badge>
38+
* </div>
39+
* ```
3840
*/
3941
@Component({
4042
selector: 'igx-badge',

skills/igniteui-angular-components/references/data-display.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ import { IgxBadgeComponent } from 'igniteui-angular/badge';
136136

137137
```html
138138
<!-- Image avatar with badge overlay -->
139-
<igx-avatar [src]="user.photo" shape="circle" size="large">
140-
<igx-badge igxAvatarBadge [type]="'success'" [icon]="'check'"></igx-badge>
141-
</igx-avatar>
139+
<div class="avatar-badge-container">
140+
<igx-avatar [src]="user.photo" shape="circle" size="large"></igx-avatar>
141+
<igx-badge [type]="'success'" [icon]="'check'"></igx-badge>
142+
</div>
142143

143144
<!-- Initials avatar -->
144145
<igx-avatar initials="JD" shape="circle"></igx-avatar>
@@ -150,6 +151,21 @@ import { IgxBadgeComponent } from 'igniteui-angular/badge';
150151
<igx-badge [type]="'error'" [value]="unreadCount"></igx-badge>
151152
```
152153

154+
```scss
155+
// Required styles to position the badge as an overlay on the avatar
156+
.avatar-badge-container {
157+
position: relative;
158+
display: inline-flex;
159+
160+
igx-badge {
161+
position: absolute;
162+
bottom: 0;
163+
right: 0;
164+
transform: translate(25%, 25%);
165+
}
166+
}
167+
```
168+
153169
Avatar shapes: `'circle'`, `'rounded'`, `'square'`. Sizes: `'small'`, `'medium'`, `'large'`, or custom CSS.
154170
Badge types: `'default'`, `'info'`, `'success'`, `'warning'`, `'error'`.
155171

0 commit comments

Comments
 (0)