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

@lifeeric/react-css-burger

v0.2.2

Published

Lightweight, dynamic, zero-dependency (and very tasty) burger for React.

Downloads

10

Readme

react-css-burger NPM Build Status Coverage Status JavaScript Style Guide

Lightweight, dynamic, zero-dependency (and very tasty) burger for React and Gatsby.

Examples

Check out the live demo: https://mattvox.github.io/react-css-burger

Install

yarn add @lifeeric/react-css-burger

Or with npm

npm install --save @lifeeric/react-css-burger

Usage

This delicious burger uses sensible defaults, so only minimal configuration via props is necessary.

Basic configuration

Renders a basic, "boring" burger

import Burger from "@lifeeric/react-css-burger";

class App extends Component {
  state = {
    active: false
  };

  render() {
    return (
      <Burger
        onClick={() => this.setState({ active: !this.state.active })}
        active={this.state.active}
      />
    );
  }
}

Advanced configuration

Renders a burger with the "arrow" animation, in pink, with a hover opacity of 80%, at 120% scale.

import Burger from "@lifeeric/react-css-burger";

class App extends Component {
  state = {
    active: false
  };

  render() {
    return (
      <Burger
        onClick={() => this.setState({ active: !this.state.active })}
        active={this.state.active}
        burger="arrow"
        color="pink"
        hoverOpacity={0.8}
        scale={1.2}
      />
    );
  }
}

Animations

Burger animations are set with the burger prop. To see all the available animations in action, please check out the live demo at https://mattvox.github.io/react-css-burger. The default animation is "boring", although this can be substituted for any one of the following strings values:

  • arrow
  • arrowalt
  • arrowturn
  • boring
  • collapse
  • elastic
  • emphatic
  • minus
  • slider
  • spin
  • spring
  • squeeze
  • stand
  • vortex
  • 3dx
  • 3dy
  • 3dxy

Props

React CSS Burger uses CSS Variables to provide a dynamic experience, ensuring the perfect, and most delicious burger for every situation. All properties are optional, although active must be used to toggle the burger's state.

  • active - Boolean - toggles the burger state (see above example)
  • onClick - Function - usually used to toggle the burger's state (see above example)
  • burger - String - sets the specific animation (see animations above)
  • color - String - sets the burger's color value (ie. 'pink' or '#AD2E74')
  • hoverOpacity - Number - sets the opacity when hovered (ie. 0.8)
  • marginTop - String - sets the burger's margin-top (ie. '25px')
  • marginTop - String - sets the burger's margin-left (ie. '25px')
  • scale - Number - sets the burger's scale value (ie. 1.25)
  • style - Object - style object is passed through to allow for custom styling (YMMV)

Browser Support

React CSS Burger utilizes modern CSS3 features, such as CSS variables, and is only meant for use with modern browsers, but smart fallbacks are provided to allow for graceful degradation when viewed on an older browser.

Similar Projects

Not using React? Check out the project this one is based on: Jonathan Suh's Hamburgers

Acknowledgements

This component is heavily inspired by Jonathan Suh's Hamburgers and implements almost all of his original CSS.

License

MIT © mattvox