You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@rmwc/elevation

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/elevation

RMWC Elevation component

14.3.5
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Elevation

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

  • Module @rmwc/elevation
  • Import styles:
    • Using CSS Loader
      • import '@rmwc/elevation/styles';
    • Or include stylesheets
      • '@material/elevation/dist/mdc.elevation.css'
  • MDC Docs: https://material.io/develop/web/components/elevation/
<>
  {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

NameTypeDescription
transitionbooleanAllows for smooth transitions between elevations when the z value changes.
wrapbooleanAllows the elevation classes to be merged onto the child component instead of creating an new DOM node.
zstring | numberA number from 0 - 24 for different levels of elevation

Keywords

rmwc

FAQs

Package last updated on 24 Oct 2024

Did you know?

Socket

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.

Install

Related posts