Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hamburger-menu

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hamburger-menu

Dead simple Hamburger Menu to use as a mobile nav, with a bunch of styling options.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.2K
decreased by-0.68%
Maintainers
1
Weekly downloads
 
Created
Source

React Hamburger Menu

Built for React, this is a handy UI component for a menu icon in a mobile site or application.

Installation

react-hamburger-menu requires React 0.14 or later.

npm install --save react-hamburger-menu

Demo & Example

Live demo: cameronbourke.github.io/react-hamburger-menu

To build the example locally, clone this repo then run:

npm install
npm start
Then open localhost:8080 in a browser.

Usage

React Hamburger Menu only has two required props. They are isOpen and menuClicked. The other 7 props are optional.

menuClicked

Note: This prop is passed a function. This function will be invoked when the component is clicked. The function should responsible for updating the state that is passed to isOpen. The function passed to menuClicked could look something like the following:

handleClick() {
	this.setState({
		open: !this.state.open
	});
}

An example use of React Hamburger Menu looks like:

<HamburgerMenu
	isOpen={this.state.open}
	menuClicked={this.handleClick.bind(this)}
	width={18}
	height={15}
	strokeWidth={1}
	rotate={0}
	color='black'
	borderRadius={0}
	animationDuration={0.5}
/>

Note, not all props are required. All the props besides isOpen and menuClicked have defaults.

Options

PropertyTypeDefaultDescription
isOpenboolundefineddetermines whether the menu is a hamburger or cross icon
menuClickedfuncundefinedwill be invoked when the component is clicked
widthnumber36the width of the icon
heightnumber30the height of the icon
strokeWidthnumber2the stroke width of the lines
rotatenumber0the rotation of the icon, eg {45} would be 45deg
colorstring#000the color of both icons
borderRadiusnumber0the border radius of the lines
animationDurationnumber0.4the length of time it takes for the icon transitions to complete.
classNamestringundefinedthe class name for the container element

Todo

  • Add Unit Tests

License

MIT Licensed Copyright (c) Cameron Bourke 2016

Keywords

FAQs

Package last updated on 06 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc