Skip to content

Commit d75a87d

Browse files
authored
docs(material/badge): don't use inline elements in badge demo (#25758)
The badge docs were saying that badges might not work on inline elements while the example was still using inline elements itself. These changes update the example to use `div` elements instead. Fixes #25751.
1 parent 147a354 commit d75a87d

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:host {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: flex-start;
5+
}
6+
7+
.demo-section + .demo-section {
8+
margin-top: 16px;
9+
}
Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
1-
<p>
21
<!-- #docregion mat-badge-overlap -->
3-
<span matBadge="4" matBadgeOverlap="false">Text with a badge</span>
2+
<div matBadge="4" matBadgeOverlap="false" class="demo-section">Text with a badge</div>
43
<!-- #enddocregion mat-badge-overlap -->
5-
</p>
64

7-
<p>
85
<!-- #docregion mat-badge-size -->
9-
<span matBadge="1" matBadgeSize="large">Text with large badge</span>
6+
<div matBadge="1" matBadgeSize="large" class="demo-section">Text with large badge</div>
107
<!-- #enddocregion mat-badge-size -->
11-
</p>
128

13-
<p>
9+
<div class="demo-section">
1410
Button with a badge on the left
1511
<!-- #docregion mat-badge-position -->
1612
<button mat-raised-button color="primary"
1713
matBadge="8" matBadgePosition="before" matBadgeColor="accent">
1814
Action
1915
</button>
2016
<!-- #enddocregion mat-badge-position -->
21-
</p>
17+
</div>
2218

23-
<p>
19+
<div class="demo-section">
2420
Button toggles badge visibility
2521
<!-- #docregion mat-badge-hide -->
2622
<button mat-raised-button matBadge="7" [matBadgeHidden]="hidden" (click)="toggleBadgeVisibility()">
2723
Hide
2824
</button>
2925
<!-- #enddocregion mat-badge-hide -->
30-
</p>
26+
</div>
3127

32-
<p>
28+
<div class="demo-section">
3329
Icon with a badge
3430
<!-- #docregion mat-badge-color -->
3531
<mat-icon matBadge="15" matBadgeColor="warn">home</mat-icon>
@@ -38,6 +34,4 @@
3834
<span class="cdk-visually-hidden">
3935
Example with a home icon with overlaid badge showing the number 15
4036
</span>
41-
</p>
42-
43-
37+
</div>

src/components-examples/material/badge/badge-overview/badge-overview-example.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Component} from '@angular/core';
66
@Component({
77
selector: 'badge-overview-example',
88
templateUrl: 'badge-overview-example.html',
9+
styleUrls: ['badge-overview-example.css'],
910
})
1011
export class BadgeOverviewExample {
1112
hidden = false;

0 commit comments

Comments
 (0)