Skip to content
Merged
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
20 changes: 14 additions & 6 deletions en/components/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,16 @@ igx-badge {

### Badge Value and Icon

Use the `[value]` input to display text or a numeric count inside the badge. This is the recommended approach instead of projecting content directly:
Use the `[value]` input to display text or a numeric count inside the badge:

```html
<!-- Recommended -->
<igx-badge [value]="model.value"></igx-badge>
```

Use the `[icon]` input to display an icon inside the badge:

<!-- Avoid -->
<igx-badge>{{ model.value }}</igx-badge>
```html
<igx-badge icon="check" type="success"></igx-badge>
```

When both `[icon]` and `[value]` are set, the badge displays both simultaneously:
Expand All @@ -159,10 +161,16 @@ When both `[icon]` and `[value]` are set, the badge displays both simultaneously
<igx-badge icon="check" value="5" type="success"></igx-badge>
```

To display only a numeric value without an icon, make sure `[icon]` is not set:
Or you can project content directly:

```html
<igx-badge [value]="unreadCount" type="info"></igx-badge>
<igx-badge>{{ model.value }}</igx-badge>

<!-- When projecting both icon and text, wrap the text to keep correct padding. -->
<igx-badge>
<igx-icon>bluetooth</igx-icon>
<span>Bluetooth</span>
</igx-badge>
```

### Badge Icon
Expand Down
Loading