Skip to content

docs(material/badge): don't use inline elements in badge demo #25758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:host {
display: flex;
flex-direction: column;
align-items: flex-start;
}

.demo-section + .demo-section {
margin-top: 16px;
}
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
<p>
<!-- #docregion mat-badge-overlap -->
<span matBadge="4" matBadgeOverlap="false">Text with a badge</span>
<div matBadge="4" matBadgeOverlap="false" class="demo-section">Text with a badge</div>
<!-- #enddocregion mat-badge-overlap -->
</p>

<p>
<!-- #docregion mat-badge-size -->
<span matBadge="1" matBadgeSize="large">Text with large badge</span>
<div matBadge="1" matBadgeSize="large" class="demo-section">Text with large badge</div>
<!-- #enddocregion mat-badge-size -->
</p>

<p>
<div class="demo-section">
Button with a badge on the left
<!-- #docregion mat-badge-position -->
<button mat-raised-button color="primary"
matBadge="8" matBadgePosition="before" matBadgeColor="accent">
Action
</button>
<!-- #enddocregion mat-badge-position -->
</p>
</div>

<p>
<div class="demo-section">
Button toggles badge visibility
<!-- #docregion mat-badge-hide -->
<button mat-raised-button matBadge="7" [matBadgeHidden]="hidden" (click)="toggleBadgeVisibility()">
Hide
</button>
<!-- #enddocregion mat-badge-hide -->
</p>
</div>

<p>
<div class="demo-section">
Icon with a badge
<!-- #docregion mat-badge-color -->
<mat-icon matBadge="15" matBadgeColor="warn">home</mat-icon>
Expand All @@ -38,6 +34,4 @@
<span class="cdk-visually-hidden">
Example with a home icon with overlaid badge showing the number 15
</span>
</p>


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Component} from '@angular/core';
@Component({
selector: 'badge-overview-example',
templateUrl: 'badge-overview-example.html',
styleUrls: ['badge-overview-example.css'],
})
export class BadgeOverviewExample {
hidden = false;
Expand Down