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

@kawaiininja/drawer

v1.0.18

Published

Adaptive Drawer component for Onyx Framework

Readme

@kawaiininja/drawer

An adaptive, touch-friendly drawer component for React applications. It automatically switches between a side panel (desktop) and a bottom sheet (mobile) with high-end spring animations and interactive gestures.

Features

  • Adaptive Layout: Side panel on desktop, bottom sheet on mobile.
  • Portal Rendering: Bulletproof rendering via React Portal to avoid z-index/overflow issues.
  • Universal Dragging: Drag from anywhere on the panel to close (mobile & desktop).
  • Smooth Spring Physics: Refined exponential easing for a premium, non-overshooting feel.
  • Bulletproof Scroll Lock: Absolute body locking to prevent background leaking.
  • Interactive Loading State: Pulse-stretching handle bar for async operations.
  • Design Tokens: Fully tokenized z-indices, durations, and easings.
  • Tailwind Compatible: Easy to style with Onyx-standard utility classes.

Installation

npm install @kawaiininja/drawer

Tailwind Configuration

Add the drawer to your content configuration to ensure internal styles (like the handle bar) are correctly applied:

// tailwind.config.js
module.exports = {
  content: [
    // ...
    "./node_modules/@kawaiininja/drawer/dist/**/*.{js,ts,jsx,tsx}",
  ],
  // ...
};

Usage

import { AdaptiveDrawer } from "@kawaiininja/drawer";
import { useState } from "react";

function App() {
  const [isOpen, setIsOpen] = useState(false);
  const [isLoading, setIsLoading] = useState(false);

  const handleSave = async () => {
    setIsLoading(true);
    await new Promise((r) => setTimeout(r, 2000));
    setIsLoading(false);
    setIsOpen(false);
  };

  return (
    <div>
      <button onClick={() => setIsOpen(true)}>Open Drawer</button>

      <AdaptiveDrawer
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        isLoading={isLoading}
        closeOnOutsideTap={true}
        title={<h2>Settings</h2>}
        side="right"
        width="480px"
        footer={<button onClick={handleSave}>Save Changes</button>}
      >
        <div className="space-y-4">
          <p>Drawer content goes here...</p>
        </div>
      </AdaptiveDrawer>
    </div>
  );
}

Props

| Prop | Type | Default | Description | | -------------------- | ------------------- | ---------- | ----------------------------------------------- | | isOpen | boolean | required | Controls if the drawer is visible | | onClose | function | required | Callback when the drawer should close | | title | ReactNode | - | Header content | | children | ReactNode | - | Main drawer content | | footer | ReactNode | - | Optional sticky footer content | | side | "left" \| "right" | "right" | Which side the panel appears on desktop | | width | string | "480px" | Width of the panel on desktop | | isLoading | boolean | false | Animates the handle bar with a pulse-stretch | | closeOnOutsideTap | boolean | true | Whether clicking the backdrop closes the drawer | | className | string | "" | Additional CSS classes for the drawer panel | | containerClassName | string | "" | Additional CSS classes for the backdrop/overlay |

Theming (CSS Variables)

You can easily customize the drawer's appearance by overriding these CSS variables in your global style file:

:root {
  /* Colors */
  --drawer-bg: #000000;
  --drawer-border: #27272a;
  --drawer-overlay: rgba(9, 9, 11, 0.8);
  --drawer-handle: #27272a;
  --drawer-text: #ffffff;
  --drawer-text-muted: #a1a1aa;
  --drawer-footer-bg: #000000;
  --drawer-footer-border: #18181b;

  /* Layout & Dimensions */
  --drawer-width-desktop: 480px;
  --drawer-max-height-mobile: 92dvh;
  --drawer-radius-mobile: 2.5rem;
  --drawer-radius-desktop: 2rem;

  /* Z-Index */
  --drawer-z-overlay: 99998;
  --drawer-z-drawer: 99999;
}

Design Tokens

The component uses a centralized token system for consistency:

  • Spring Easing: cubic-bezier(0.19, 1, 0.22, 1) (Smooth Exponential)
  • Standard Durations: Fast (200ms), Normal (400ms), Slow (500ms)
  • Z-Indices: Overlay (99998), Drawer (99999)