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-svg-seatmap

v1.0.16

Published

React components that render a highly-customizable seatmap based on a provided SVG

Readme

react-svg-seatmap

Storybook NPM Version

React components that render a highly-customizable seatmap based on a provided SVG.

This package includes:

  • SeatmapInput: Use an SVG seatmap as a controlled component for choosing seats
  • SeatmapAccordion: Use an SVG seatmap as a navigational tool for showing seat details

summary

Check it out here: Storybook

Features

  • Use custom icons and colors to group seats
  • Pan and zoom functionality
  • Select all seats in a group at once
  • Drag to quickly multiple seats drag

Installation

Install the package via NPM:

npm install --save react-svg-seatmap

Usage

SeatmapInput

import { useState } from "react";
import { SeatmapInput } from "react-svg-seatmap";

export default () => {
  const [selectedSeats, setSelectedSeats] = useState<number[]>([]);

  const svgUrl = "https://www.test.com/svg";

  const seats = [
    {
      id: 1,
      cssSelector: "#seat-1-1-1", // The query selector that can be used to find this seat on the SVG
      displayGroup: "1", // Optional: The color or icon group that this seat should belong to
      selectionGroups: {
        row: "1",  // Optional: The groups that should be selected when this seat is selected
      },
    },
  ];

  return (
    <form>
      <SeatmapInput
        seats={seats}
        svg={svgUrl}
        value={selectedSeats}
        onChange={setSelectedSeats}
      />
    </form>
  );
};

SeatmapAccordion

import { useState } from "react";
import { SeatmapAccordion } from "react-svg-seatmap";

export default () => {
  const svgUrl = "https://www.test.com/svg";

  const seats = [
    {
      id: 1,
      cssSelector: "#seat-1-1-1", // The query selector that can be used to find this seat on the SVG
      displayGroup: "1", // Optional: The color or icon group that this seat should belong to
      selectionGroups: {
        row: "1", // Optional: The groups that should be selected when this seat is selected
      },
    },
  ];

  const handleSeatSelect = (selectedSeatId: number) => {
    alert(`You have clicked seat ${selectedSeatId}!`);
  };

  return (
    <SeatmapAccordion seats={seats} svg={svgUrl} onClick={handleSeatSelect} />
  );
};

Props

Seats | Name | Type | Description | | --------- | ------------------- | ------------------------------- | | id | number | The unique ID of the seat | | cssSelector | string | The unique query string that be used to find this seat on the SVG | | displayGroup | string | (Optional) The display group that this seat belongs to. Used to match against values passed in the displyGroupMapping prop | | selectionGroups | Record<string, string> | (Optional) If groupSelection is set to true in the seatmap component, this prop is used to determine the groups that can be used to select this seat (and that should be selected if this seat is selected). For instance, if this value contains { row: "A" }, clicking on any other seat in the "row A" group while selecting "row" groups will select this seat|

SeatmapInput | Name | Type | Description | | --------- | ------------------- | ------------------------------- | | svg | string | URL for an svg to render as the seatmap | | seats | Seat[] | The seats available to be selected on the seatmap. You can think of this as the "options" for the seatmap | | value | number[] | The IDs of all currently selected seats. Since this is a controlled component, this prop controls which seats are considered to be selected, and so should be stored in state. | | onChange | (selectedSeats: number[]) => void | Function that is run when the user changes the selected seats (either selection or deselection). Since this is a controlled component, the function argument is the new "value" for the seatmap. | | displayGroupMapping | Record<string, string | ReactNode> For example: { "A": "#ef857d", "B": "#de5472", "C": "#5a8ef7", "D": "#9b98e5"} | A mapping object that translates between a display group and a color or icon. If a seat is given a display group value, this object is used to determine how that seat should be displayed | | leftControls | ReactNode[] | An array of React components that will be rendered on the top left-hand side of the seatmap. This can be useful for setting up extra controls within the seatmap itself. | | rightControls | ReactNode[] | An array of React components that will be rendered on the top right-hand side of the seatmap. This can be useful for setting up extra controls within the seatmap itself. |

SeatmapAccordion | Name | Type | Description | | --------- | ------------------- | ------------------------------- | | svg | string | URL for an svg to render as the seatmap | | seats | Seat[] | The seats available to be selected on the seatmap. You can think of this as the "options" for the seatmap | | selectedSeatIds | number[] | The IDs of all currently selected seats. This prop sets the seats that should be selected, and so should be stored in state. | | onClick | (seatId: number, selected: boolean) => void | Function that is run when an available seat is clicked. The function argument is the ID of the clicked seat, and whether it was selected or deselected. | | displayGroupMapping | Record<string, string | ReactNode> For example: { "A": "#ef857d", "B": "#de5472", "C": "#5a8ef7", "D": "#9b98e5"} | A mapping object that translates between a display group and a color or icon. If a seat is given a display group value, this object is used to determine how that seat should be displayed | | leftControls | ReactNode[] | An array of React components that will be rendered on the top left-hand side of the seatmap. This can be useful for setting up extra controls within the seatmap itself. | | rightControls | ReactNode[] | An array of React components that will be rendered on the top right-hand side of the seatmap. This can be useful for setting up extra controls within the seatmap itself. |

License

MIT Licence