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

@aravindvjn/react-sidebar

v1.0.0

Published

A flexible, responsive React sidebar component built with the Context API. Supports nested menus, hover expansion, mobile drawer behavior, and smooth animations, without being tied to any routing or styling library.

Readme

@aravindvjn/react-sidebar

A flexible, responsive React sidebar component built with the Context API. Supports nested menus, hover expansion, mobile drawer behavior, and smooth animations, without being tied to any routing or styling library.


Features

  • Lightweight and reusable
  • Built with React Context API
  • Works in both mobile and desktop layouts
  • Router agnostic (Next.js, React Router, etc.)
  • Smooth animations powered by Motion
  • Nested menu and submenu support
  • Fully customizable
  • Ships with default CSS (no Tailwind required)

Installation

npm install @aravindvjn/react-sidebar

or

pnpm add @aravindvjn/react-sidebar

Peer Dependencies

npm install react react-dom motion

Usage

1. Import styles (required)

import "@aravindvjn/react-sidebar/styles.css";

2. Use components

import {
  Sidebar,
  SidebarProvider,
  SidebarTrigger,
} from "@aravindvjn/react-sidebar";

import { useState } from "react";

const items = [
  {
    id: "dashboard",
    label: "Dashboard",
    path: "/dashboard",
  },
  {
    id: "users",
    label: "Users",
    children: [
      {
        id: "all-users",
        label: "All Users",
        path: "/users",
      },
      {
        id: "pending-users",
        label: "Pending Users",
        path: "/users/pending",
      },
    ],
  },
];

export default function App() {
  const [pathname, setPathname] = useState("/dashboard");

  return (
    <SidebarProvider
      items={items}
      pathname={pathname}
      onNavigate={(path) => setPathname(path)}
    >
      <div style={{ display: "flex", minHeight: "100vh" }}>
        <Sidebar
          renderHeader={
            <div
              style={{
                padding: "20px 16px",
                fontSize: 16,
                fontWeight: 600,
              }}
            >
              My App
            </div>
          }
        />

        <main style={{ flex: 1, padding: 24 }}>
          <SidebarTrigger>
            Toggle Sidebar
          </SidebarTrigger>

          <p style={{ marginTop: 16 }}>
            Current path: {pathname}
          </p>
        </main>
      </div>
    </SidebarProvider>
  );
}

Menu Item Structure

type SidebarItem = {
  id: string;
  label: string;
  icon?: React.ReactNode;
  path?: string;
  children?: SidebarItem[];
  disabled?: boolean;
};

SidebarProvider Props

| Prop | Type | Description | | ----------------- | ------------------------ | ---------------------- | | items | SidebarItem[] | Sidebar menu items | | pathname | string | Current active path | | onNavigate | (path: string) => void | Navigation handler | | defaultExpanded | boolean | Initial expanded state | | defaultPinned | boolean | Keep sidebar expanded | | collapseMode | "hover" \| "toggle" | Expansion behavior |


Sidebar Props

| Prop | Type | Description | | ---------------- | ----------------- | ----------------------- | | className | string | Custom container styles | | renderHeader | React.ReactNode | Custom header content | | expandedWidth | number | Width when expanded | | collapsedWidth | number | Width when collapsed |


Styling

This package ships with a default stylesheet.

You can override styles in two ways:

1. Override className

<Sidebar className="my-sidebar" />

2. Override CSS variables

:root {
  --rv-sidebar-bg: #111827;
  --rv-sidebar-active-bg: #22c55e;
  --rv-sidebar-active-text: #04130a;
}

Behavior

  • Hover to expand (when collapseMode="hover")
  • Click to toggle submenu
  • Automatically highlights active menu using pathname
  • Mobile drawer with overlay
  • Closes on navigation (mobile)

Mobile Support

  • Automatic breakpoint detection
  • Slide-in sidebar
  • Background overlay
  • Click outside to close

Animations

Animations are powered by Motion:

  • Sidebar expand/collapse
  • Submenu open/close
  • Mobile drawer transitions

Advanced Usage

Access internal state using the hook:

import { useSidebar } from "@aravindvjn/react-sidebar";

const { isExpanded, isMobile } = useSidebar();

Versioning

  • patch → bug fixes
  • minor → new features
  • major → breaking changes

Roadmap

  • Controlled state mode
  • Render prop support
  • Headless (unstyled) version
  • Improved accessibility

License

MIT


Author

Aravind Vijayan