Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions projects/igniteui-angular/badge/src/badge/badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ export type IgxBadgeType = (typeof IgxBadgeType)[keyof typeof IgxBadgeType];
*
* @example
* ```html
* <igx-avatar>
* <igx-badge icon="check" type="success"></igx-badge>
* </igx-avatar>
* <div class="avatar-badge-container">
* <igx-avatar icon="person" shape="circle" size="small"></igx-avatar>
* <igx-badge icon="check" type="success" shape="square"></igx-badge>
* </div>
* ```
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example switches from projecting the badge into the avatar to placing both in a wrapper div, but it doesn't mention the CSS required to actually overlay the badge (e.g., relative positioning on the container and absolute positioning on the badge). Without that, the example will render the badge next to the avatar rather than as an overlay—please include a brief note and/or reference to the required styles.

Suggested change
* ```
* ```
*
* The wrapper needs positioning styles so the badge is overlaid on the avatar instead of rendering
* next to it:
*
* ```css
* .avatar-badge-container {
* position: relative;
* display: inline-block;
* }
*
* .avatar-badge-container igx-badge {
* position: absolute;
* right: 0;
* bottom: 0;
* }
* ```

Copilot uses AI. Check for mistakes.
*/
@Component({
selector: 'igx-badge',
Expand Down
24 changes: 20 additions & 4 deletions skills/igniteui-angular-components/references/data-display.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ import { IgxBadgeComponent } from 'igniteui-angular/badge';

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

<!-- Initials avatar -->
<igx-avatar initials="JD" shape="circle"></igx-avatar>
Expand All @@ -150,8 +151,23 @@ import { IgxBadgeComponent } from 'igniteui-angular/badge';
<igx-badge [type]="'error'" [value]="unreadCount"></igx-badge>
```

```scss
// Required styles to position the badge as an overlay on the avatar
.avatar-badge-container {
position: relative;
display: inline-flex;

igx-badge {
position: absolute;
bottom: 0;
right: 0;
transform: translate(25%, 25%);
}
}
```

Avatar shapes: `'circle'`, `'rounded'`, `'square'`. Sizes: `'small'`, `'medium'`, `'large'`, or custom CSS.
Badge types: `'default'`, `'info'`, `'success'`, `'warning'`, `'error'`.
Badge types: `'primary'`, `'info'`, `'success'`, `'warning'`, `'error'`.

## Icon

Expand Down
Loading