JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4919
  • Score
    100M100P100Q138992F
  • License MIT

A sliding panel for React applications

Package Exports

  • react-sliding-side-panel
  • react-sliding-side-panel/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-sliding-side-panel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-sliding-side-panel

Demo

Installation and usage

The easiest way to use react-sliding-side-panel is to install it from npm and build it into your app with Webpack.

npm install --save react-sliding-side-panel

Then use it in your app:

import React, { useState } from 'react';
import SlidingPanel from 'react-sliding-side-panel';
import 'react-sliding-side-panel/lib/index.css';

const App = () => {
  const [openPanel, setOpenPanel] = useState(false);
  return (
    <div>
      <div>
        <button onClick={() => setOpenPanel(true)}>Open</button>
      </div>
      <SlidingPanel
        type={'left'}
        isOpen={openPanel}
        size={30}
      >
        <div>
          <div>My Panel Content</div>
          <button onClick={() => setOpenPanel(false)}>close</button>
        </div>
      </SlidingPanel>
    </div>
  );
};

export default App;

Props

Common props you may want to specify include:

  • type - left | right | top | bottom, specify the sliding panel position
  • size - number between 0 and 100, specify the sliding panel size in percentage of the page size
  • isOpen - boolean, open or close the sliding panel

This component uses CSSTransition under the hood, so you can also specify the following props:

  • panelContainerClassName - an optional additional classname for the panel container
  • panelClassName - an optional additional classname for the panel content
  • noBackdrop - an optional boolean to set to true if you don't want a backdrop panel
  • onOpen - Similar to onEnter
  • onOpening - Similar to onEntering
  • onOpened - Similar to onEntered
  • onClose - Similar to onExit
  • onClosing - Similar to onExiting
  • onClosed - Similar to onExited
  • backdropClicked - Callback called when the backdrop is clicked