🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

cheeseburger-menu

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheeseburger-menu

A simple sliding side menu component for React

latest
Source
npmnpm
Version
0.0.14
Version published
Weekly downloads
165
-14.06%
Maintainers
1
Weekly downloads
 
Created
Source

Cheeseburger Menu

A simple sliding side menu component for React.

This component provides the sliding menu only, not the hamburger button. For your button I'd suggest react-hamburger-menu.

Demo

https://codesandbox.io/s/qxL744Qx2

Usage

Cheeseburger Menu has two required props, isOpen and closeCallback, plus a number of optional props described below. Your content should go inside as child components.

closeCallback will be called when the user taps out of the menu, or when they slide it closed.

Example:

import CheeseburgerMenu from 'cheeseburger-menu'

...

<CheeseburgerMenu isOpen={menuIsOpen} closeCallback={closeMenu}>
  <div className="my-menu-content">
    <ul>
      <li><Link to="/thing1" onClick={closeMenu}>Menu item 1</Link></li>
      <li><Link to="/thing2" onClick={closeMenu}>Menu item 2</Link></li>
    </ul>
  </div>
</CheeseburgerMenu>

Optional props

nametypedefaultdescription
rightboolfalseIf true, menu will slide in from the right (default is left)
transitionTimenumber0.3Slide in/out duration in seconds
topOffsetnumber or string0Distance between the top of the viewport and the top of the menu (if you want the menu to appear beneath your header). Can be a number (of pixels) or any valid CSS length, e.g. '2em'.
bottomOffsetnumber or string0Same as topOffset but for the bottom
widthnumber300Menu width in pixels
backgroundColorstring'white'Background color for the menu
noShadowboolfalseIf true, there will be no shadow at the edge of the menu
skewYnumber0Vertical skew in degrees
className, overlayClassName, outerClassName, innerClassName, shadowClassNamestringundefinedProps for adding classes to the various elements

Additional custom styling can be done with CSS.

License

ISC License

Copyright (c) 2017-2023, Eddie McLean

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Keywords

react

FAQs

Package last updated on 02 Aug 2023

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