react-sliding-side-panel
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

react-sliding-side-panel

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.53,290latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.53,290
2.0.40
2.0.31,194
2.0.20
2.0.10
2.0.00
1.1.81,192
1.1.70
1.1.60
1.1.50
1.1.40
1.1.30
1.1.10
1.1.00
1.0.150
1.0.1428
1.0.130
1.0.120
1.0.110
1.0.100
1.0.910
1.0.80
1.0.70
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i react-sliding-side-panel

Weekly Downloads

5,714

Version

2.0.5

License

MIT

Unpacked Size

18.3 kB

Total Files

8

Last publish

Collaborators

  • benedicte