Skip to content

docs(sidenav): add docs for hasBackdrop #10287

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 2 commits into from
Mar 6, 2018
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
10 changes: 9 additions & 1 deletion src/lib/sidenav/sidenav.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ If no `mode` is specified, `over` is used by default.

<!-- example(sidenav-mode) -->

`<mat-drawer>` also supports all of these same modes.
The `over` and `push` sidenav modes show a backdrop by default, while the `side` mode does not. This
can be customized by setting the `hasBackdrop` property on `mat-sidenav-container`. Explicitly
setting `hasBackdrop` to `true` or `false` will override the default backdrop visibility setting for
all sidenavs regadless of mode. Leaving the property unset or setting it to `null` will use the
default backdrop visibility for each mode.

<!-- example(sidenav-backdrop) -->

`<mat-drawer>` also supports all of these same modes and options.

### Disabling automatic close

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.example-container {
width: 400px;
height: 200px;
margin: 10px;
border: 1px solid #555;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<mat-drawer-container class="example-container" [hasBackdrop]="hasBackdrop.value">
<mat-drawer #drawer [mode]="mode.value">I'm a drawer</mat-drawer>
<mat-drawer-content>
<mat-form-field>
<mat-label>Sidenav mode</mat-label>
<mat-select #mode value="side">
<mat-option value="side">Side</mat-option>
<mat-option value="over">Over</mat-option>
<mat-option value="push">Push</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Has backdrop</mat-label>
<mat-select #hasBackdrop>
<mat-option>Unset</mat-option>
<mat-option [value]="true">True</mat-option>
<mat-option [value]="false">False</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button (click)="drawer.toggle()">Toggle drawer</button>
</mat-drawer-content>
</mat-drawer-container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {Component} from '@angular/core';

/** @title Drawer with explicit backdrop setting */
@Component({
selector: 'sidenav-backdrop-example',
templateUrl: 'sidenav-backdrop-example.html',
styleUrls: ['sidenav-backdrop-example.css'],
})
export class SidenavBackdropExample {}