Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@material/elevation
Advanced tools
Material Components for the web mixins + CSS Classes for Material Design elevation
Shadows provide important visual cues about objects’ depth and directional movement. They are the only visual cue indicating the amount of separation between surfaces. An object’s elevation determines the appearance of its shadow. The elevation values are mapped out in a "z-space" and range from 0
to 24
.
A note about "z-space": Within the spec, elevation is normally referred to as having a
dp
value. In other words, how many "pixels" above the base material is a piece of material elevated. On a computer, this is normally represented by a 3-d coordinate system. We likez-space
(or just "z" for short) because it aligns with the technical definition of, and nomenclature for, a 3-d coordinate system. Therefore, we feel it makes more sense thandp
. However, when we refer toz-space
(orz
), that can be used interchangeably with the spec'sdp
.
npm install @material/elevation
Elevation is often already included within the baseline styles of other components (e.g. raised buttons, elevated cards).
However, you can also apply elevation to specific components using mdc-elevation--z<N>
classes:
<div class="mdc-elevation--z1">
<!-- ... content ... -->
</div>
The elevation overlay should appear above the component container in the stacking context but below the ripple. To accomplish this, the .mdc-elevation-overlay
element should appear before the .mdc-<component>__ripple
element in the DOM context. Here's sample markup for a button with a touch target.
<button class="mdc-button mdc-button--raised">
<div class="mdc-elevation-overlay"></div>
<div class="mdc-button__ripple"></div>
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
<span class="mdc-button__label">Font Icon</span>
</button>
This ensures the ripple parts are rendered above the overlay.
@use "@material/elevation/mdc-elevation";
Some components have a set elevation. For example, a raised MDC Button has elevation 2.
If you want to set the elevation of an element, which is not a Material Design component, you can apply the following CSS classes.
CSS Class | Description |
---|---|
mdc-elevation--z<N> | Sets the elevation to the (N)dp, where 1 <= N <= 24 |
mdc-elevation-transition | Applies the correct css rules to transition an element between elevations |
Mixin | Description |
---|---|
elevation($z-value, $color, $opacity-boost) | Sets the elevation to the z-space for that given elevation, and optionally sets the color and/or boosts the opacity of the shadow |
overlay-common | Called once per application to setup the universal elevation overlay styles |
shadow($box-shadow) | Sets the box-shadow of the closest parent selector |
overlay-surface-position | Sets the positioning of the overlay's surface element so that the overlay can be appropriately centered |
overlay-dimensions($width, $height: $width, $has-content-sizing: true) | Sets the dimensions of the elevation overlay |
overlay-fill-color($color) | Sets the color of the elevation overlay |
overlay-opacity($opacity) | Sets the opacity of the elevation overlay |
Function | Description |
---|---|
transition-value($duration, $easing) | Returns a value for the transition property to transition an element between elevations |
overlay-transition-value($duration, $easing) | Returns a value for the transition property to transition the elevation overlay between elevations |
Variable | Description |
---|---|
$property | Default property for elevation transitions |
$transition-duration | Default duration value for elevation transitions |
$transition-timing-function | Default easing value for elevation transitions |
$overlay-color | Default color for the elevation overlay |
$overlay-property | Default property for the elevation overlay transitions |
If you need more configurability over your transitions, use the transition-value
function in conjunction with the exported sass variables.
@use "@material/elevation";
.my-component-with-custom-transitions {
transition:
elevation.transition-value(),
/* Configure opacity to use same duration and easing values as elevation */
opacity elevation.$transition-duration elevation.$transition-timing-function;
opacity: .7;
will-change: elevation.$property, opacity;
}
6.0.0 (2020-04-22)
[@use](https://github.com/use)
(098ae32)indeterminate
checkbox (b273afa)select: HTML Markup significantly changed, see README; REMOVED adapter methods isSelectedTextFocused
, getSelectedTextAttr
, setSelectedTextAttr
; ADDED adapter methods isSelectAnchorFocused
, getSelectAnchorAttr
, setSelectAnchorAttr
; removed variables outlined-dense-label-position-y
, icon-padding
; added variables minimum-height-for-filled-label
, filled-baseline-top
, selected-text-height
, anchor-padding-left
, anchor-padding-left-with-leading-icon
, anchor-padding-right
.
text-field: Redundant mixins mdc-text-field-textarea-fill-color
, mdc-text-field-textarea-stroke-color
, mdc-text-field-fullwidth-bottom-line-color
removed. Instead, use mdc-text-field-fill-color
, mdc-text-field-outline-color
, and mdc-text-field-bottom-line-color
respectively to achieve the same effect.
textfield: mdc-text-field--dense and associated mixins/variables have been removed. Use the density() mixin instead.
textfield: removed the following variables: $input-padding
, $input-padding-top
, $input-padding-bottom
, $outlined-input-padding-top
, $outlined-input-padding-bottom
, $input-border-bottom
linear-progress: DOM for linear progress buffer changed. MDCLinearProgressAdapter method getBuffer
, getPrimaryBar
, setStyle
removed. MDCLinearProgressAdapter method setBufferBarStyle
, setPrimaryBarStyle
added.
linear-progress: DOM for linear progress buffer changed. MDCLinearProgressAdapter method getBuffer
, getPrimaryBar
, setStyle
removed. MDCLinearProgressAdapter method setBufferBarStyle
, setPrimaryBarStyle
added.
typography: typography.baseline-top()
and typography.baseline-bottom()
are now private. Use typography.baseline()
for containers and typography.text-baseline()
for text with $top and $bottom params.
chips: The touch target and text now appear inside the primary action element. Please see the readme for markup changes.
textfield: filled text fields must include a <div class="mdc-text-field__ripple"></div>
textfield: Filled textfields will no longer show a floating label at certain densities. This can be overridden by setting $mdc-text-field-minimum-height-for-filled-label: 40px
chips: Both MDCChipAdapter
and MDCChipSetAdapter
have new methods. MDCChipSetFoundation
event handlers now accept the corresponding chip event detail interface as the sole argument. The root
property has been removed from the MDCChipRemovalEventDetail
interface.
line-ripple: mdc-line-ripple-color()
mixin has been renamed to mdc-line-ripple-active-color()
textfield: Default textfields must now specify mdc-text-field--filled. Disabled outlined textfields no longer have a shaded background. Height mixin no longer specifies a baseline override, use typography's baseline-top mixin.
Four variables and a mixin in mdc-textfield were renamed to use a mdc-text-field- prefix when depended on via @import (formerly mdc-required-text-field-label-asterisk_, now required-label-asterisk_).
textfield: icons must use .mdc-text-field__icon--leading
or .mdc-text-field__icon--trailing
classes. mdc-text-field-icon-color()
mixin has been split into mdc-text-field-leading-icon-color()
and mdc-text-field-trailing-icon-color()
.
switch: Added setNativeControlAttr method in mdc-switch adapter.
checkbox: remove event listener for 'change' and add event listener for 'click'.
$mdc-button-disabled-container-fill-color
renamed to $mdc-button-disabled-container-color
.$edgeOptOut
option from mdc-theme-prop()
Sass mixin.FAQs
Material Components for the web mixins + CSS Classes for Material Design elevation
The npm package @material/elevation receives a total of 761,521 weekly downloads. As such, @material/elevation popularity was classified as popular.
We found that @material/elevation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.