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

react-hamburger-menus

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hamburger-menus

A react library for creating animated hamburger menu with CSS transitions.

  • 1.0.16
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
79
increased by5.33%
Maintainers
1
Weekly downloads
 
Created
Source

react-hamburger-menus

Congrats! You just saved yourself hours of work by using react-animated-navbars library for creating animated navigation panels

Demo

Take a look at the live demo!

Installation

install it using npm or yarn to include it in your own React project

You will also need to import css modules in root your project before using it. dist/react-animated-navbars.cjs.development.css

npm

npm i react-hamburger-menus

yarn

yarn add react-hamburger-menus

Usage

Ghost Navbar

  • Import GhostNavbar component from react-animated-navbars
  • Import styles react-animated-navbars/dist/style.css
import React from "react";
import { GhostNavbar } from "react-hamburger-menus";
import "react-hamburger-menus/dist/style.css";

const App = () => {
  return (
    <>
      <GhostNavbar
        styles={{
          floatButtonSize: 0.9,
          floatButtonX: 6,
          floatButtonY: 4
        }}
      >
        <ul>
          <li>ABOUT</li>
          <li>PROJECTS</li>
          <li>ELEMENTS</li>
          <li>CONTACT</li>
        </ul>
      </GhostNavbar>
    </>
  );
};

export default App;
Using with next js/ Gatsby js or other React Framework for application routing
import Link from 'next/link'
.
.
  <ul>
    <li>
      <Link href="/"> Home </Link>
    </li>  
    .
    .

🔨 API

Props

Direct props use ul tag with li or else animations wont be applied

PropTypeDefaultDescription
childrenReactNode (ul > li)optionalNavbar items
classNamestringoptionalBase class
stylesstyles objectoptionalBase styles
iconHeight, iconWidth, iconColorstringoptionalIcon style
floatButtonXnumber85Ghost button X position from right
floatButtonYnumber2Ghost button Y position from top
listHoverColor[string, string][color 1, color 2]Hover animation color
fontColor, fontSize, fontHoverColoroptionalstringcommon text styling
zIndexnumberoptionalz-Index (1000)
leftReveal, rightReveal, backgroundBox, backgroundCirclestringleftReveal backgroundCircleannimation types
STYLES

If you want custom styles pass your CSS styling(Javascript Object) in Styles props using specific key mentioned below to apply styling correctly.

Take a look at the live demo for custom styling!

PropertyTypeDefaultDescription
navigationReact CSS PropertiesoptionalBase styling
navigationButtonReact CSS PropertiesoptionalGhost button styling
navigationIconReact CSS PropertiesoptionalGhost icon styling
navigationBackgroundReact CSS PropertiesoptionalPanel background styling

Responsive Navbar

Preview

Small screen

Large screen

import React from "react";
import { ResponsiveNavbar } from "react-hamburger-menus";
import "react-hamburger-menus/dist/style.css";

export const Default = () => (
  <ResponsiveNavbar
    logo={<p>Logo</p>}
    styles={{
      navigation: { fontFamily: 'Arial, Helvetica, sans-serif' },
      navigationBarSmall: {
        backgroundColor: 'aliceblue',
      },
      navigationCardSmall: {
        backgroundColor: 'aliceblue',
      },
    }}
  >
      <ul>
        <li>ABOUT</li>
        <li>PROJECTS</li>
        <li>ELEMENTS</li>
        <li>CONTACT</li>
      </ul>

  </ResponsiveNavbar>
);

🔨 API

Props

Direct props use ul tag with li or else animations wont be applied

PropTypeDefaultDescription
childrenReactNode (ul > li)optionalNavbar items
classNamestringoptionalBase class
stylesstyles objectoptionalBase styles
logoReactNodeoptionalNavbar logo
iconColor, iconWidth, iconHeightstringoptionalIcon styling (toggle)
zIndexnumberoptionalz-Index (1000)
animationDelaynumberstringoptional
toggleNavigationBarSmallValuebooleanoptionalmanual toggle value
toggleNavigationBarSmallFunctionVoidFunctionoptionalmanual toggle function
STYLES

If you want custom styles pass your CSS styling(Javascript Object) in Styles props using specific key mentioned below to apply styling correctly.

Take a look at the live demo for custom styling!

PropertyTypeDefaultDescription
navigationReact CSS PropertiesoptionalBase styling
navigationBarSmallReact CSS PropertiesoptionalNavbar small screen styling
navigationButtonSmallReact CSS PropertiesoptionalNavbar button small screen styling (toggle)
navigationCardSmallReact CSS PropertiesoptionalNavbar card small screen styling (toggle)
navigationBarLargeReact CSS PropertiesoptionalNavbar card large screen styling (toggle)

Ghost Button

import React from "react";
import { GhostButton } from "react-hamburger-menus";
import "react-hamburger-menus/dist/style.css";

const App = () => {
  return (
    <>
      <GhostButton
        styles={{
          floatButtonX: 85,
          floatButtonY: 7
        }}
      >
          <ul>
          <li>ABOUT</li>
          <li>PROJECTS</li>
          <li>ELEMENTS</li>
          <li>CONTACT</li>
        </ul>
        </GhostButton>
    </>
  );
};

export default App;
Using icon or html (as icon)
.
  <GhostButton
    icon={
      <p style={{ fontSize: '19px', borderBottom: '1px solid grey' }}>Users</p>
    }
    />
.
.

🔨 API

Props
PropTypeDefaultDescription
childrenReactNode (ul > li)optionalNavbar items
classNamestringoptionalBase class
stylesstyles objectoptionalBase styles
iconReactNodeoptionalcustom icon
floatButtonSizenumberoptionalGhost button size (just number)
floatButtonXnumber85Ghost button X position from right
floatButtonYnumber2Ghost button Y position from top
fontColor, fontSizeoptionalstringcommon text styling
iconHeight, iconWidth, iconColorstringoptionalIcon style
listHoverColorstringaquaHover animation color
zIndexnumberoptionalz-Index (1000)
STYLES

Take a look at the live demo for custom styling!

PropertyTypeDefaultDescription
navigationReact CSS PropertiesoptionalBase styling
navigationButtonReact CSS PropertiesoptionalGhost button styling
navigationIconReact CSS PropertiesoptionalGhost icon styling
navigationCardReact CSS PropertiesoptionalPanel pop-up card styling

🐛 Bug Reporting

The Library is in developing stage

  • Feel free to Open an issue on GitHub to request any additional features you might need for your use case.
  • Connect with me on LinkedIn. I'd love ❤️️ to hear where you are using this library.

Browser support

Because this project uses CSS3 features, it's only meant for modern browsers. Some browsers currently fail to apply some of the animations correctly.

It is well tested for chrome, safari and firefox.

📜 License

This software is open source, licensed under the MIT License.

Keywords

FAQs

Package last updated on 12 Jun 2022

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