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

aznavrail-web

v1.0.0

Published

A React component that provides a Material Design-style navigation rail.

Readme

AzNavRail for Web

aznavrail-web is a React component that provides a Material Design-style navigation rail, inspired by its counterpart in the Android ecosystem. It is designed to be a "batteries-included" solution, offering a highly configurable and easy-to-use navigation component for web applications.

Features

  • Expandable and Collapsible: A compact rail that expands into a full menu drawer.
  • Configurable Items: Supports standard, toggle, and cycler navigation items.
  • DSL-like Configuration: Use a simple JavaScript array of objects to define the navigation content, similar to a DSL.
  • Dynamic Text Resizing: Text inside the rail buttons automatically resizes to fit, preventing overflow.
  • Customizable: Easily customize dimensions, colors, and behavior through a settings prop.

Getting Started

Prerequisites

Installation

  1. Copy the aznavrail-web/src/components and aznavrail-web/src/hooks directories into your project's source folder.
  2. Ensure you have the necessary dependencies by installing them if you haven't already:
    npm install react react-dom

Usage

To use the AzNavRail component, import it into your application and provide it with content and settings props.

import React, { useState } from 'react';
import AzNavRail from './components/AzNavRail';
import './App.css'; // Ensure you have styles for your layout

function App() {
  const [isPowerOn, setIsPowerOn] = useState(true);
  const [theme, setTheme] = useState('Light');

  const navItems = [
    {
      id: 'home',
      text: 'Home',
      isRailItem: true,
      onClick: () => console.log('Home clicked'),
    },
    {
      id: 'power',
      isRailItem: true,
      isToggle: true,
      isChecked: isPowerOn,
      toggleOnText: 'Power On',
      toggleOffText: 'Power Off',
      onClick: () => setIsPowerOn(!isPowerOn),
      color: 'green',
    },
    {
      id: 'theme',
      isRailItem: true,
      isCycler: true,
      options: ['Light', 'Dark', 'System'],
      selectedOption: theme,
      onClick: (selectedTheme) => setTheme(selectedTheme),
      color: 'purple',
    },
    {
      id: 'settings',
      text: 'Settings',
      onClick: () => console.log('Settings clicked'),
    },
  ];

  const railSettings = {
    appName: 'My Awesome App',
    displayAppNameInHeader: true,
  };

  return (
    <div className="App">
      <AzNavRail content={navItems} settings={railSettings} />
      <main className="main-content">
        <h1>Main Content Area</h1>
        <p>Power is currently: {isPowerOn ? 'On' : 'Off'}</p>
        <p>Selected theme is: {theme}</p>
      </main>
    </div>
  );
}

export default App;

Configuration

AzNavRail Props

| Prop | Type | Default | Description | | ------------------- | --------- | ----------------- | --------------------------------------------------------------------------- | | content | Array | [] | An array of navigation item objects. | | settings | Object | {} | An object for customizing the rail's appearance and behavior. | | initiallyExpanded | boolean | false | Sets the initial expanded state of the rail. | | disableSwipeToOpen| boolean | false | (Not yet implemented) Disables the swipe-to-open gesture. |

settings Object

| Key | Type | Default | Description | | ------------------------ | --------- | ---------- | ------------------------------------------------------------------------ | | appName | string | 'App' | The name of the app, displayed in the header. | | displayAppNameInHeader | boolean | false | If true, shows appName in the header instead of an icon. | | expandedRailWidth | string | '260px' | The width of the rail when expanded. | | collapsedRailWidth | string | '80px' | The width of the rail when collapsed. | | showFooter | boolean | true | Whether to display the footer section in the expanded menu. | | isLoading | boolean | false | If true, shows a loading indicator instead of the navigation content. | | packRailButtons | boolean | false | If true, packs the rail buttons at the top instead of spacing them out.|

Navigation Item Object (content array)

Each object in the content array defines a navigation item.

| Key | Type | Required | Description | | --------------- | --------- | -------- | ------------------------------------------------------------------------------ | | id | string | Yes | A unique identifier for the item. | | onClick | function| Yes | The callback function executed on click. | | isRailItem | boolean | No | If true, the item appears in the collapsed rail as well as the expanded menu.| | text | string | Yes | The text for a standard menu item. Supports \n for multi-line text. | | isToggle | boolean | No | Set to true for a toggle item. | | isChecked | boolean | No | The current state of a toggle item. Required if isToggle is true. | | toggleOnText | string | No | Text for the "on" state. Required if isToggle is true. | | toggleOffText | string | No | Text for the "off" state. Required if isToggle is true. | | isCycler | boolean | No | Set to true for a cycler item. | | options | Array | No | An array of strings for the cycler options. Required if isCycler is true. | | selectedOption| string | No | The currently selected option. Required if isCycler is true. | | color | string | No | The border color for a rail button (e.g., 'red', '#FF5733'). |