@rmwc/elevation
TypeScript icon, indicating that this package has built-in type declarations

14.3.5 • Public • Published

Elevation

Elevation is the relative distance between two surfaces along the z-axis.

<>
  {Array(25)
    .fill(undefined)
    .map((val, i) => (
      <Elevation z={i} key={i}>
        {i}dp
      </Elevation>
    ))}
</>
function Example() {
  const [elevation, setElevation] = React.useState(0);

  return (
    <Elevation
      z={elevation}
      transition
      onMouseOver={() => setElevation(24)}
      onMouseOut={() => setElevation(0)}
    >
      Hover Me {elevation}dp
    </Elevation>
  );
}

Wrapping Children

You can avoid adding extra DOM nodes by using the wrap prop on elevation. This will apply the classes directly to the child component. Additionally, Elevation is simply a className, so you can achieve the same effect by adding className="mdc-elevation--z15".

<Elevation z={21} wrap>
  <span>Wrapped!</span>
</Elevation>

Elevation

The Elevation Component

Props

Name Type Description
transition boolean Allows for smooth transitions between elevations when the z value changes.
wrap boolean Allows the elevation classes to be merged onto the child component instead of creating an new DOM node.
z string | number A number from 0 - 24 for different levels of elevation

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
14.3.5313latest
14.0.2-alpha.71next

Version History

VersionDownloads (Last 7 Days)Published
14.3.5313
14.3.42
14.3.31
14.3.21
14.3.10
14.3.00
14.2.90
14.2.80
14.2.70
14.2.61
14.2.50
14.2.22,054
14.2.12
14.2.00
14.1.50
14.1.42
14.1.30
14.1.20
14.1.10
14.1.00
14.0.120
14.0.110
14.0.100
14.0.90
14.0.81
14.0.71
14.0.60
14.0.51
14.0.41
14.0.30
14.0.20
14.0.10
14.0.00
14.0.2-alpha.71
14.0.2-alpha.60
14.0.2-alpha.50
14.0.2-alpha.40
14.0.2-alpha.30
14.0.2-alpha.10
14.0.2-alpha.00
14.0.1-alpha.00
14.0.0-alpha.00
8.0.8421
8.0.753
8.0.60
8.0.50
8.0.4225
8.0.379
8.0.20
8.0.11
8.0.00
7.0.397
7.0.20
7.0.10
7.0.00
6.1.4206
6.1.00
6.0.140
6.0.130
6.0.120
6.0.110
6.0.100
6.0.90
6.0.50
6.0.40
6.0.30
6.0.20
6.0.10
6.0.00
6.0.0-rc.40
6.0.0-rc.30
6.0.0-rc.20
6.0.0-rc.11
6.0.0-rc.00
6.0.0-alpha.160
6.0.0-alpha.150
6.0.0-alpha.140
6.0.0-alpha.130
6.0.0-alpha.120
6.0.0-alpha.111
6.0.0-alpha.70
5.7.2317
6.0.0-alpha.60
6.0.0-alpha.50
6.0.0-alpha.40
6.0.0-alpha.30
6.0.0-alpha.10
5.7.0198
5.6.022
5.5.226
5.5.1296
5.5.00
5.4.30
5.4.20
5.4.10
5.4.00
5.3.10
5.3.00
5.2.26
5.2.11
5.2.00
5.2.0-alpha.00
5.1.811
5.1.70
5.1.60
5.1.50
5.1.40
5.1.30
5.1.20
5.1.11
5.1.00
5.0.30-rc.00
5.0.29-rc.00
5.0.28-rc.00
5.0.27-rc.00
5.0.26-rc.00
5.0.25-rc.01
5.0.24-rc.00
5.0.23-rc.00
5.0.23-alpha.00
5.0.22-alpha.00
5.0.21-alpha.01
5.0.20-alpha.00
5.0.19-alpha.00
5.0.18-alpha.00
5.0.17-alpha.00
5.0.16-alpha.00
5.0.15-alpha.00
5.0.14-alpha.00
5.0.13-alpha.00
5.0.12-alpha.00
5.0.8-alpha.00
5.0.7-alpha.00
5.0.6-alpha.00
5.0.5-alpha.00
5.0.4-alpha.00
5.0.3-alpha.00
5.0.2-alpha.00
5.0.1-alpha.00
5.0.0-alpha.00
4.0.68
4.0.50
4.0.40
4.0.20
4.0.10
4.0.00
3.0.1149
3.0.100
3.0.90
3.0.80
3.0.70
3.0.60
3.0.50
3.0.40
3.0.00
2.2.04
2.1.30
2.1.20
2.1.00
2.0.20
2.0.10
2.0.00
2.0.0-alpha.71
2.0.0-alpha.60
2.0.0-alpha.50
2.0.0-alpha.40
2.0.0-alpha.30
2.0.0-alpha.20
2.0.0-alpha.10
2.0.0-alpha.00
1.10.1-alpha.00
1.10.0-alpha.00

Package Sidebar

Install

npm i @rmwc/elevation

Weekly Downloads

4,407

Version

14.3.5

License

MIT

Unpacked Size

4.42 kB

Total Files

9

Last publish

Collaborators

  • jamesmfriedman