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

react-shadow-component

v2.0.3

Published

Simple and intuitive wasy to add shadow

Downloads

7

Readme

react-shadow-component

NPM version Build npm-typescript License

react-shadow-component, a powerful and versatile package that allows you to easily add various box shadow styles to your React components. With this package, you can eliminate the need to write complex CSS code and add professional-looking shadows to your components with ease.

Installation

To install react-shadow-component, simply run the following command:

# NPM
npm install react-shadow-component

# Yarn
yarn add react-shadow-component

Usage

react-shadow-component is an HOC that can be applied to any React component. Here's an example of how you can use it:

BoxShadow

import React from 'react'
import { BoxShadow } from 'react-shadow-component'

export const MyComponent = () => {
  return (
    <div>
      <BoxShadow color='#000' blur={15} spread={5} offsetX={9} offsetY={15}>
        <div className='box'>Hello</div>
      </BoxShadow>
    </div>
  )
}

WithShadow (HOC)

You can also use the WithShadow provider with props to style all BoxShadow component:

import React from 'react'
import { BoxShadow, WithShadow } from 'react-shadow-component'

function App() {
  return (
    <div>
      <WithShadow blur={10} color={'rgba(0,0,0,0.45)'}>
        <BoxShadow color='#000' offsetX={0} blur={15}>
          <div className='box'>Hello</div>
        </BoxShadow>
        <BoxShadow>
          <div className='box'>Hello</div>
        </BoxShadow>
        <BoxShadow>
          <div className='box'>Hello</div>
        </BoxShadow>
      </WithShadow>
    </div>
  )
}

export default App

Note

  • If you pass props to the BoxShadow component and use the WithShadow component, the props passed to the BoxShadow component will take precedence.

Props

The BoxShadow component accepts the following props:

  • blur: This prop controls the size of the shadow. A higher value will result in a larger shadow, while a lower value will result in a smaller shadow.

  • spread: This prop controls the spread of the shadow. A higher value will result in a wider spread, while a lower value will result in a more focused shadow.

  • color: This prop controls the color of the shadow. You can set it as a CSS color string, like #000000 for black color.

  • offsetX: This prop controls the horizontal offset of the shadow. A positive value will move the shadow to the right, while a negative value will move the shadow to the left.

  • offsetY: This prop controls the vertical offset of the shadow. A positive value will move the shadow down, while a negative value will move the shadow up.

Conclusion

This package is a simple way to add box-shadow to your React elements. You can use the Shadow component to add a box-shadow to a single element, or the WithShadow provider to add box-shadow to all BoxShadow components. You can customize the shadow by passing in blur, spread, offsetX, offsetY and color props to BoxShadow or WithShadow.