Skip to content

Commit b37c748

Browse files
mmalerbatinayuangao
authored andcommitted
chore(sidenav): add fullscreen and fab examples to docs (#1966)
* Added fullscreen example. * Added fullscreen example * fix language * Added fab example
1 parent a5eab75 commit b37c748

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

src/lib/sidenav/README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,86 @@ Here's a simple example of using the sidenav:
7777
</app>
7878
```
7979

80+
For a fullscreen sidenav, the recommended approach is set up the DOM such that the
81+
`md-sidenav-layout` can naturally take up the full space:
82+
83+
```html
84+
<app>
85+
<md-sidenav-layout>
86+
<md-sidenav mode="side" opened="true">Drawer content</md-sidenav>
87+
<div class="my-content">Main content</div>
88+
</md-sidenav-layout>
89+
</app>
90+
```
91+
```css
92+
html, body, material-app, md-sidenav-layout, .my-content {
93+
margin: 0;
94+
width: 100%;
95+
height: 100%;
96+
}
97+
```
98+
99+
For a sidenav with a FAB (or other floating element), the recommended approach is to place the FAB
100+
outside of the scrollable region and absolutely position it.
101+
102+
```html
103+
<app>
104+
<md-sidenav-layout class="my-layout">
105+
<md-sidenav mode="side" opened="true">
106+
<button md-mini-fab class="my-fab">
107+
<md-icon>add</md-icon>
108+
</button>
109+
<div class="my-scrolling-content">
110+
Lorem ipsum dolor sit amet, pede a libero aenean phasellus, lectus metus sint ut risus,
111+
fusce vel in pellentesque. Nisl rutrum etiam morbi consectetuer tempor magna, aenean nullam
112+
nunc id, neque vivamus interdum sociis nulla scelerisque sem, dolor id wisi turpis magna
113+
aliquam magna. Risus accumsan hac eget etiam donec sed, senectus erat mattis quam, tempor
114+
vel urna occaecat cras, metus urna augue nec at. Et morbi amet dui praesent, nec eu at,
115+
ligula ipsum dui sollicitudin, quis nisl massa viverra ligula, mauris fermentum orci arcu
116+
enim fringilla. Arcu erat nulla in aenean lacinia ullamcorper, urna ante nam et sagittis,
117+
tristique vehicula nibh ipsum vivamus, proin proin. Porta commodo nibh quis libero amet.
118+
Taciti dui, sapien consectetuer.
119+
</div>
120+
</md-sidenav>
121+
<button md-mini-fab class="my-fab">
122+
<md-icon>add</md-icon>
123+
</button>
124+
<div class="my-scrolling-content">
125+
Lorem ipsum dolor sit amet, pede a libero aenean phasellus, lectus metus sint ut risus, fusce
126+
vel in pellentesque. Nisl rutrum etiam morbi consectetuer tempor magna, aenean nullam nunc id,
127+
neque vivamus interdum sociis nulla scelerisque sem, dolor id wisi turpis magna aliquam magna.
128+
Risus accumsan hac eget etiam donec sed, senectus erat mattis quam, tempor vel urna occaecat
129+
cras, metus urna augue nec at. Et morbi amet dui praesent, nec eu at, ligula ipsum dui
130+
sollicitudin, quis nisl massa viverra ligula, mauris fermentum orci arcu enim fringilla. Arcu
131+
erat nulla in aenean lacinia ullamcorper, urna ante nam et sagittis, tristique vehicula nibh
132+
ipsum vivamus, proin proin. Porta commodo nibh quis libero amet. Taciti dui, sapien
133+
consectetuer.
134+
</div>
135+
</md-sidenav-layout>
136+
</app>
137+
```
138+
```css
139+
.my-layout {
140+
width: 500px;
141+
height: 300px;
142+
}
143+
144+
.my-layout md-sidenav {
145+
max-width: 200px;
146+
}
147+
148+
.my-layout .md-sidenav-content,
149+
.my-layout md-sidenav {
150+
display: flex;
151+
}
152+
153+
.my-scrolling-content {
154+
overflow: auto;
155+
}
156+
157+
button.my-fab {
158+
position: absolute;
159+
right: 20px;
160+
bottom: 10px;
161+
}
162+
```

0 commit comments

Comments
 (0)