Skip to content

drawer 1.4.5

Install from the command line:
Learn more about npm packages
$ npm install @jeremiemeunier/drawer@1.4.5
Install via package.json:
"@jeremiemeunier/drawer": "1.4.5"

About this version

@jeremiemeunier/drawer

Slide-in side panel with a React context and hook.

Installation

Create a .npmrc file at the root of your project so npm can access the GitHub registry:

@jeremiemeunier:registry=https://npm.pkg.github.com

Then install the package:

npm install @jeremiemeunier/drawer

Usage

Wrap your application with the DrawerProvider and control the drawer through the useDrawer hook:

import { DrawerProvider, useDrawer } from "@jeremiemeunier/drawer";

const App = () => {
  const { openDrawer, pushContent } = useDrawer();

  return (
    <DrawerProvider>
      <button
        onClick={() => {
          pushContent(<div>My drawer content</div>);
          openDrawer();
        }}
      >
        Open drawer
      </button>
    </DrawerProvider>
  );
};

API

  • DrawerProvider – context provider wrapping your app.
  • useDrawer() – hook returning pushContent, openDrawer, closeDrawer, and switchDrawer functions.

The drawer uses framer-motion for animations and simplebar-react for scrollbars.

Details


Assets

  • drawer-1.4.5.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0