-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Docs (Guides): Mat elevation guide #3917
Changes from 7 commits
935554e
a4a430c
3de9111
2033bb4
04dff5d
6160ef2
9b73991
3efe1ec
0952077
8b54aab
2db4d31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# mat-elevation | ||
mat-elevation exists to give you separation between elements. | ||
All material design elements have resting elevations. | ||
[`Material design`](https://material.io/guidelines/material-design/elevation-shadows.html) | ||
explains how best to use elevation. | ||
|
||
|
||
Elevation is implemented with a class, simply adding the class `mat-elevation-z#` where # is the elevation number you want, 0-24. | ||
|
||
## Example | ||
<!-- example(elevation-overview) --> | ||
|
||
|
||
## Mixins | ||
In order to use the mixin for Elevation you must | ||
`@import '~@angular/material/core/style/_elevation.scss';` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok yeah I'll have to fix this then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @willshowell Do you know if i will need to specify elevation.scss from that path? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @M-a-c no that should error. Using the master builds, check out your node_modules. At And due to Sass importing of partials, you don't need the leading underscore or file extension in your import statement. |
||
$zValue must be a value between 0 and 24, inclusive. | ||
`@include mat-elevation($zValue);` | ||
|
||
|
||
How to use the mixin | ||
```scss | ||
.myClass { | ||
@include $mat-elevation(2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be without the |
||
|
||
&:active { | ||
@include $mat-elevation(8); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
} | ||
} | ||
``` | ||
|
||
## Deprecated | ||
The use of `mdElevation($zValue)` is deprecated. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use the words attribute / directive in this text to be more clear? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="dynamimc">Hover over me!</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean dynamic? |
||
|
||
<div class"no-elevation">No Elevation</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does adding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah good point, I removed it in the next commit |
||
|
||
<div class="mat-elevation-z24">Static class for styling</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@import '~@angular/material/core/style/_elevation.scss'; | ||
|
||
div { | ||
width: auto; | ||
display: block; | ||
text-align: center; | ||
height: 50px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
background-color: lightblue; | ||
margin-top: 10px; | ||
} | ||
|
||
.dynamimc { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
@include $mat-elevation(2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also without |
||
|
||
&:active { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be |
||
@include $mat-elevation(8); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'elevation-overview-example', | ||
styleUrls: ['./elevation-overview-example.scss'], | ||
templateUrl: './elevation-overview-example.html', | ||
}) | ||
|
||
export class ElevationOverviewExample {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you feel about this?