npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-slide-panel

v1.0.1

Published

Easy to use and flexible modal drawer/sidebar component for React (TypeScript)

Readme

react-slide-panel

A React component that renders a slide-out drawer (or sidebar panel) from any edge of the screen—right, left, top, or bottom. It uses a modal overlay, optional scroll lock, and supports header, body, and footer slots. Written in TypeScript. Port of vue3-side-panel.

Install

npm install react-slide-panel
# or
yarn add react-slide-panel
# or
pnpm add react-slide-panel

Peer dependencies: react and react-dom (>= 16.8.0).

Usage

Import the component and the default styles:

import { SlidePanel } from 'react-slide-panel';
import 'react-slide-panel/dist/styles.css';

function App() {
  const [open, setOpen] = useState(false);

  return (
    <>
      <button onClick={() => setOpen(true)}>Open drawer</button>
      <SlidePanel
        open={open}
        onOpenChange={setOpen}
        side="right"
        width="400px"
        header={<h2>Title</h2>}
        footer={<button onClick={() => setOpen(false)}>Done</button>}
      >
        <p>Drawer content goes here.</p>
      </SlidePanel>
    </>
  );
}

Open/close is controlled via the open and onOpenChange props. The drawer is rendered in a portal and can slide in from top, right, bottom, or left.

A demo app in the repo (npm run demo from the root) shows more examples (all sides, header/footer, scroll lock, custom width, etc.).

API

SlidePanel

| Prop | Type | Default | Description | |------|------|---------|-------------| | open | boolean | required | Controlled open state | | onOpenChange | (open: boolean) => void | required | Called when open state should change | | onClosed | () => void | — | Called after leave transition finishes | | onOpened | () => void | — | Called after enter transition finishes | | idName | string | 'rsp-container' | Id for the portal container | | hideCloseBtn | boolean | false | Hide the default close button | | noClose | boolean | false | Prevent closing on overlay click | | side | 'top' \| 'right' \| 'bottom' \| 'left' | 'right' | Side the drawer slides from | | rerender | boolean | false | Unmount content when closed (remount on open) | | zIndex | number \| 'auto' | 'auto' | z-index (auto = max on page) | | width | string | 'auto' | Drawer width (left/right) | | height | string | 'auto' | Drawer height (top/bottom) | | lockScroll | boolean | false | Lock body scroll when open | | lockScrollHtml | boolean | true | Set overflow: hidden on html when locking | | overlayColor | string | 'black' | Overlay background color | | overlayOpacity | number | 0.5 | Overlay opacity (0–1) | | overlayDuration | number | 500 | Overlay transition duration (ms) | | panelColor | string | 'white' | Drawer background color | | panelDuration | number | 300 | Drawer transition duration (ms) | | transitionName | string | slide-{side} | Custom transition class name | | headerClass | string | '' | Class for header container | | bodyClass | string | '' | Class for body container | | footerClass | string | '' | Class for footer container | | header | ReactNode | — | Header content | | footer | ReactNode | — | Footer content | | children | ReactNode | — | Body content | | className | string | — | Extra class for panel root | | style | CSSProperties | — | Inline styles for panel root |

SidePanelCloseButton

Optional close button component (used by default inside the drawer).

| Prop | Type | Description | |------|------|-------------| | onClose | () => void | Called when the button is clicked | | className | string | Optional class name |

License

MIT