21.11.27 • Published 3 months ago

react-hamburger-drawer v21.11.27

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

Navigation drawer

Build Status License NPM version NPM downloads

Simple lightweight react hamburger navigation drawer (based on navigation-drawer).

Key points

  • Hidden <input type="checkbox"> as a toggle;
  • Fullscreen <label> element for veil;
  • Google Material spec for sizes, animations, and colors.

Accessibility

  • Support keyboard navigation (Tab, Esc and Enter);
  • Prevents page scrolling when the navigation drawer is open.

Usage example:

npm install react-hamburger-drawer
# Or
yarn add react-hamburger-drawer
import HamburgerDrawer from "react-hamburger-drawer";
<div className="App">
  <header>
    <HamburgerDrawer>
      <!-- Your navigation drawer content here: -->
      <ul>
        <li><a href="/">Home</a></li>
        <li><a href="/about">About</a></li>
        <li><a href="/contact">Contact</a></li>
        <li><a href="/privacy-policy">Privacy Policy</a></li>
      </ul>
    </HamburgerDrawer>
    <h1>Your Application Header</h1>
    ...
  </header>
  ...
</div>

Component props

  • useFocusBounder - An optional property to enable or disable FocusBounder component. Default false.

Next.js v13+ and other SSRs

All components inside the app directory are React Server Components by default. To use useRef or useEffect hooks, the component must be marked as client component: "use client".

Create a "drawer.js" file with the following content:

"use client";
import HamburgerDrawer from "react-hamburger-drawer";
export default HamburgerDrawer;

And import the HamburgerDrawer component from the "drawer.js" module:

import HamburgerDrawer from "./drawer";

Links:

Screenshots

21.11.27

3 months ago

21.11.26

4 months ago

21.11.25

4 months ago

21.11.24

4 months ago

21.11.23

4 months ago

21.11.22

5 months ago

21.11.21

6 months ago

21.11.20

10 months ago

21.11.19

1 year ago

21.11.18

2 years ago

21.11.15

2 years ago

21.11.14

3 years ago

21.11.12

3 years ago

21.11.17

2 years ago

21.11.16

2 years ago

21.11.9

3 years ago

21.11.8

3 years ago

21.11.7

3 years ago

21.11.11

3 years ago

21.11.10

3 years ago

21.11.3

3 years ago

21.9.5

3 years ago

21.9.4

3 years ago

21.9.3

3 years ago

21.9.2

3 years ago

21.9.1

3 years ago