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

@jaganax/seat-chart-reactjs

v0.0.7

Published

A React.js seat chart component

Readme

@jaganax/seat-chart-reactjs

A flexible and customizable React.js seat chart component for bus, train, or event seat selection. Easily integrate into your React projects to visualize and interact with seat layouts, including support for seat types, legends, booking, blocking, and multi-layer seating.

Features

  • Render seat maps with various seat types (seat, berth, driver, door, space)
  • Multi-layer support (e.g., lower deck/upper deck)
  • Selectable seats with max selection limit
  • Booked and blocked seat support
  • Custom legends for seat statuses
  • Full accessibility support (ARIA attributes, keyboard navigation)
  • Performance optimized with React.memo
  • Built with React and Tailwind CSS

Installation

npm install @jaganax/seat-chart-reactjs

Peer dependencies:

  • React 19+
  • React DOM 19+

Usage

Single Layer

Import the Chart component and provide your seat map and configuration:

import { Chart } from "@jaganax/seat-chart-reactjs";

const seatMaps = [
  "____d",
  "a[1,R1]a_ss",
  "aa_ss",
  "a[1,R1]a_ss",
  "w__aa",
  // ...more rows
];

const seatTypes = {
  a: { type: "seat", price: 100 },
  s: { type: "seat", price: 100 },
  d: { type: "driver" },
  w: { type: "door" },
};

const legends = [
  { status: "available", type: "seat" },
  { status: "booked", type: "seat" },
  { status: "blocked", type: "seat" },
  { status: "selected", type: "seat" },
];

function handleSelectionChange(seats) {
  console.log("Selected seats:", seats);
}

<Chart
  seatMaps={seatMaps}
  seatTypes={seatTypes}
  onSelectionChange={handleSelectionChange}
  bookedSeats={["2", "5", "8", "R1"]}
  blockedSeats={["4", "3", "6"]}
  legends={legends}
  maxSelectableSeats={6}
  onMaxSeatsReached={(max) => console.log(`Maximum ${max} seats allowed`)}
/>;

Multi-Layer (Double Decker)

For multi-layer seating like double-decker buses:

import { Chart } from "@jaganax/seat-chart-reactjs";

const seatMaps = {
  "Lower Deck": [
    "____d",
    "a[1,L1]a_aa",
    "aa_aa",
    "w__aa",
    "aa_aa",
  ],
  "Upper Deck": [
    "_____",
    "b[1,U1]b_bb",
    "bb_bb",
    "___bb",
    "bb_bb",
  ],
};

const seatTypes = {
  a: { type: "seat", price: 100 },
  b: { type: "berth", price: 150 },
  d: { type: "driver" },
  w: { type: "door" },
};

<Chart
  seatMaps={seatMaps}
  seatTypes={seatTypes}
  onSelectionChange={(seats) => console.log(seats)}
  bookedSeats={["L1", "U1"]}
  legends={[
    { status: "available", type: "seat" },
    { status: "available", type: "berth" },
    { status: "booked", type: "seat" },
    { status: "selected", type: "seat" },
  ]}
/>;

Props

| Prop | Type | Description | | -------------------- | -------------------------------------- | --------------------------------------------------- | | seatMaps | string[] \| Record<string, string[]> | Seat map array or object with named layers | | seatTypes | Record<string, SeatTypeConfig> | Mapping of seat type keys to type/price config | | onSelectionChange | (seats: SelectedSeat[]) => void | Callback when selection changes | | maxSelectableSeats | number | Maximum number of selectable seats | | onMaxSeatsReached | (maxSeats: number) => void | Callback when max selection limit is reached | | bookedSeats | string[] | Array of booked seat labels | | blockedSeats | string[] | Array of blocked seat labels | | legends | LegendItem[] | Array of legend items for seat statuses | | disabled | boolean | Disable all seat selection | | className | string | Additional CSS class for the chart container |

Types

type SeatStatus = "available" | "booked" | "blocked";
type SeatType = "seat" | "berth";
type LayoutType = "driver" | "door" | "space";

interface SeatTypeConfig {
  type: SeatType | LayoutType;
  price?: number;
}

interface SelectedSeat {
  label: string;
  type: SeatType;
  price: number;
  status: SeatStatus;
}

interface LegendItem {
  status: SeatStatus | "selected";
  type?: SeatType;
}

Seat Map Notation

  • Single lowercase letters map to seat types defined in seatTypes
  • _ represents empty space
  • [n,label] syntax for custom seat labeling (e.g., a[1,R1] starts numbering at 1 with label R1)

Example

See the Storybook for live examples and customization options.

Accessibility

The component includes full accessibility support:

  • ARIA grid pattern for screen readers
  • Keyboard navigation (Tab to enter/exit, Enter/Space to toggle)
  • Focus indicators
  • Descriptive labels (e.g., "Seat R1, available, $100")

License

MIT