Skip to content

Commit dfa23c0

Browse files
authored
docs(material/toolbar): add navigation bar example (angular#33420)
1 parent c069cab commit dfa23c0

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

src/components-examples/material/toolbar/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export {ToolbarMultirowExample} from './toolbar-multirow/toolbar-multirow-exampl
33
export {ToolbarSimpleExample} from './toolbar-simple/toolbar-simple-example';
44
export {ToolbarOverviewExample} from './toolbar-overview/toolbar-overview-example';
55
export {ToolbarHarnessExample} from './toolbar-harness/toolbar-harness-example';
6+
export {ToolbarNavbarExample} from './toolbar-navbar/toolbar-navbar-example';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.example-spacer {
2+
flex: 1 1 auto;
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<mat-toolbar>
2+
<span>My App</span>
3+
4+
<span class="example-spacer"></span>
5+
6+
<a mat-button>Home</a>
7+
<a mat-button>Products</a>
8+
<a mat-button>Pricing</a>
9+
<a mat-button>About</a>
10+
</mat-toolbar>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {Component} from '@angular/core';
2+
import {MatButtonModule} from '@angular/material/button';
3+
import {MatToolbarModule} from '@angular/material/toolbar';
4+
5+
/**
6+
* @title Toolbar as a navigation bar
7+
*/
8+
@Component({
9+
selector: 'toolbar-navbar-example',
10+
templateUrl: 'toolbar-navbar-example.html',
11+
styleUrl: 'toolbar-navbar-example.css',
12+
imports: [MatToolbarModule, MatButtonModule],
13+
})
14+
export class ToolbarNavbarExample {}

src/material/toolbar/toolbar.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ easily accomplished with `display: flex`:
3636
"file":"toolbar-multirow-example.css",
3737
"region":"toolbar-position-content-style"}) -->
3838

39+
### Navigation bar
40+
41+
A common use case for a toolbar is as a navigation bar containing links to
42+
different sections of an application.
43+
44+
<!-- example(toolbar-navbar) -->
45+
3946
### Accessibility
4047
By default, the toolbar assumes that it will be used in a purely decorative fashion and thus sets
4148
no roles, ARIA attributes, or keyboard shortcuts. This is equivalent to having a sequence of `<div>`

0 commit comments

Comments
 (0)