npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shadowboxing

v1.0.10

Published

Simple package for adding material-design-like shadow effects to React elements.

Downloads

17

Readme

ShadowBoxing

npm version

Simple package for adding material-design-like shadow effects to React elements.

Installation

npm i shadowboxing

Type declarations are bundled with the package

Usage

Using the ShadowBoxing element with only the level attribute specified will yield material-design-like shadow effects.

import * as ReactDOM from "react-dom"
import ShadowBoxing from "shadowboxing"

ReactDOM.render(
  (
    <ShadowBoxing level={4}>
      Cool
    </ShadowBoxing>
  ),
  document.getElementById("root") as HTMLElement
)

Alternatively the element can be used as a wrapper to produce desired shadow effects and styles on an element

import * as ReactDOM from "react-dom"
import ShadowBoxing from "shadowboxing"

ReactDOM.render(
  (
    <ShadowBoxing shadowHorizontalOffset={4} style={{border: "solid black"}}>
      Nice
    </ShadowBoxing>
  ),
  document.getElementById("root") as HTMLElement
)

Things to Note

If the element you are puting in the ShadowBoxing element has any sort of border radius and inheritted background color styling, it's recommended that you add that border styling to the ShadowBoxing element instead; otherwise the background color of the parent element will also show on the ShadowBoxing element, resulting in the child element having rounded corners and the wrapping div of the ShadowBoxing element having pointy corners

import * as ReactDOM from "react-dom"
import ShadowBoxing from "shadowboxing"

ReactDOM.render(
  (
    <div style={{backgroundColor: "red"}}>
        <ShadowBoxing shadowHorizontalOffset={4} style={{border: "solid black", borderRadius: ".25rem"}}>
          This
        </ShadowBoxing>
        <ShadowBoxing shadowHorizontalOffset={4}>
          <div style={{border: "solid black"}}>
            Instead of this
          </div>
        </ShadowBoxing>
    </div>
  ),
  document.getElementById("root") as HTMLElement
)

Initially, some elements will not render correctly when put inside of the ShadowBoxing element due to the default display: "inline-block" styling of the div which wraps the child elements put inside of the ShadowBoxing element. If this is the case, the display property can be overridden by providing a style object with the desired overriding value

import * as ReactDOM from "react-dom"
import ShadowBoxing from "shadowboxing"

ReactDOM.render(
  (
    <ShadowBoxing level={8} style={{display: "block"}}>
      <SomeConflictingElement />
    </ShadowBoxing>
  ),
  document.getElementById("root") as HTMLElement
)