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-image-section-mapper

v1.0.3

Published

react-image-section-mapper is a React component that enables users to create interactive, resizable, and draggable sections on images. It is useful for image annotation, mapping hot zones, or interactive UI elements on images.

Readme

React Image Section Mapper

A TypeScript React component for creating interactive, resizable, and draggable sections on images. Perfect for creating image maps, hotspots, or annotated areas on images.

npm license typescript

Features

  • 🎯 Create clickable sections on images
  • 🖱️ Drag & resize sections with handles
  • 📱 Responsive design
  • 🎨 Customizable themes
  • 💾 Save & load section data
  • ⌨️ TypeScript support
  • 🔒 Read-only mode
  • 🎛️ Minimum size constraints
  • 🔢 Maximum sections limit
  • 🪝 Event hooks for clicks and hovers

Demo & Examples

Live Demo: https://react-image-section-mapper-demo.vercel.app/

Demo Repo: https://github.com/mdtanvirahamedshanto/react-image-section-mapper-demo

Installation

npm install react-image-section-mapper
# or
yarn add react-image-section-mapper
# or
pnpm add react-image-section-mapper

Basic Usage

import { ImageSectionMapper } from 'react-image-section-mapper';

function App() {
  const handleSave = (sections) => {
    console.log('Sections:', sections);
    // Save sections to your backend
  };

  return (
    <ImageSectionMapper
      imageUrl="/path/to/your/image.jpg"
      onSave={handleSave}
    />
  );
}

Advanced Usage

import { ImageSectionMapper, Section } from 'react-image-section-mapper';

function AdvancedExample() {
  // Initial sections data
  const initialSections: Section[] = [
    {
      id: '1',
      x: 100,
      y: 100,
      width: 200,
      height: 150,
      title: 'Custom Section',
      link: '/custom-link'
    }
  ];

  // Handlers
  const handleSave = async (sections: Section[]) => {
    try {
      await saveToBackend(sections);
    } catch (error) {
      console.error('Failed to save sections:', error);
    }
  };

  const handleSectionClick = (section: Section) => {
    console.log('Clicked section:', section);
  };

  const handleSectionHover = (section: Section | null) => {
    if (section) {
      console.log('Hovering section:', section);
    }
  };

  return (
    <ImageSectionMapper
      imageUrl="/path/to/your/image.jpg"
      initialSections={initialSections}
      onSave={handleSave}
      onSectionClick={handleSectionClick}
      onSectionHover={handleSectionHover}
      sectionTitlePrefix="Area"
      minSectionSize={50}
      maxSections={10}
      theme={{
        primary: 'blue',
        secondary: 'gray',
        danger: 'red',
        success: 'green'
      }}
      readOnly={false}
      controls={true}
      className="custom-mapper"
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | imageUrl | string | Required | URL of the image to map sections on | | onSave | (sections: Section[]) => void \| Promise<void> | - | Callback when sections are saved | | initialSections | Section[] | [] | Initial sections to display | | sectionTitlePrefix | string | 'Section' | Prefix for auto-generated section titles | | className | string | '' | Additional CSS classes | | controls | boolean | true | Show/hide control buttons | | theme | Theme | defaultTheme | Custom theme colors | | minSectionSize | number | 20 | Minimum width/height of sections | | maxSections | number | - | Maximum number of sections allowed | | readOnly | boolean | false | Disable editing capabilities | | onSectionClick | (section: Section) => void | - | Callback when a section is clicked | | onSectionHover | (section: Section \| null) => void | - | Callback when a section is hovered |

Types

Section

interface Section {
  id?: string;
  x: number;
  y: number;
  width: number;
  height: number;
  title: string;
  link?: string;
}

Theme

interface Theme {
  primary: string;
  secondary: string;
  danger: string;
  success: string;
}

Styling

The component uses Tailwind CSS classes by default. You can customize the appearance by:

  1. Using the theme prop to change colors
  2. Providing custom classes via the className prop
  3. Overriding the default styles in your CSS
/* Example custom styles */
.custom-mapper .section-title {
  font-weight: bold;
}

.custom-mapper .resize-handle:hover {
  background-color: #4a90e2;
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development

# Install dependencies
npm install

# Run type checking
npm run type-check

# Build the package
npm run build

# Run tests
npm test

License

MIT © Md Tanvir Ahamed Shanto

Support

If you have any questions or need help, please:

  1. Check the issues for existing problems and solutions
  2. Create a new issue if your problem isn't already reported
  3. Contact the maintainers

Made with ❤️ by Md Tanvir Ahamed Shanto