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-marker-viewer

v0.1.6

Published

A powerful, zero-config, and responsive image annotation library for React. Add markers to images, edit details, upload photos, and manage state with ease.

Downloads

456

Readme

React Image Marker Viewer 0.1.6

A powerful, zero-config, and responsive image annotation library for React. Add markers to images, edit details, upload photos, and manage state with ease.

Features

  • Zero Config: No external CSS import required! Styles are automatically injected.
  • 🎯 Responsive & Adaptive: Images automatically fit within your container (vertically or horizontally) while maintaining aspect ratio. Markers stay in correct percentage-based positions.
  • 🛠️ Full Control: Logic is separated into a useMarkerState hook, giving you full control over the marker data.
  • 🖼️ Image Support: Works with any image URL or base64 string.
  • 📝 Rich Details: Add titles, notes, and colors to markers.
  • 📸 Photo Attachments: Upload up to 3 photos per marker (stored as Base64).
  • 🔍 Lightbox: Built-in full-screen lightbox with zoom and pan support.
  • 🖱️ Drag & Drop: Drag markers to reposition them.
  • 🗑️ Long Press Delete: Hold a marker for 500ms to delete it.
  • 🌍 Localization: Auto-detects English (en), Turkish (tr), and Spanish (es).
  • 🎨 Scoped Styling: Uses semantic class names (e.g., .react-image-marker-container) for easy override.

Installation

npm install react-image-marker-viewer
# or
yarn add react-image-marker-viewer

Usage

1. Import Hook and Component

import { ImageMarker, useMarkerState } from 'react-image-marker-viewer';

function App() {
  // 1. Initialize state with the hook
  const { 
    markers,       // Read: Current array of markers
    addMarker,     // Write: Function to add a marker
    updateMarker,  // Write: Function to update a marker
    removeMarker,  // Write: Function to delete a marker
    setAllMarkers  // Write: Function to replace all markers (e.g. from DB)
  } = useMarkerState();

  return (
    // 2. Define a container with your desired dimensions
    <div style={{ width: '100%', height: '600px', border: '1px solid #ccc' }}>
      
      {/* 3. Render the component */}
      <ImageMarker
        src="https://example.com/image.jpg"
        markers={markers}
        onAddMarker={addMarker}
        onUpdateMarker={updateMarker}
        onDeleteMarker={removeMarker}
      />
      
    </div>
  );
}

2. Read-Only Mode

You can render the component in read-only mode, which disables adding, moving, or editing markers. Clicking a marker (if needed) can still trigger custom logic or be ignored.

<ImageMarker
  src="..."
  markers={markers}
  readOnly={true} // Markers are visible but not interactive
/>

Props: ImageMarker

| Prop | Type | Description | |------|------|-------------| | src | string | URL or Base64 string of the image. | | markers | Marker[] | Array of marker objects. | | onAddMarker | (marker: Marker) => void | Callback when a new marker is saved. | | onUpdateMarker | (id: string, updates: Partial<Marker>) => void | Callback when a marker is updated. | | onDeleteMarker | (id: string) => void | Callback when a marker is deleted. | | readOnly | boolean | Optional. If true, disables adding, editing, or moving markers. Default: false. |

Hook: useMarkerState

A helper hook to manage marker state easily. You can essentially build your own UI around the data returned by this hook.

const { 
  markers,        // Marker[]
  addMarker,      // (marker: Marker) => void
  updateMarker,   // (id: string, updates: Partial<Marker>) => void
  removeMarker,   // (id: string) => void
  setAllMarkers   // (markers: Marker[]) => void
} = useMarkerState();

Styling & Class Names

The library injects its own CSS automatically. You can override styles by targeting these semantic class names:

| Class Name | Description | |------------|-------------| | .react-image-marker-container | The outer container. | | .react-image-marker-wrapper | The wrapper around the image (positioning context). | | .react-image-marker-image | The actual image element. | | .react-image-marker-item | The circular marker element. | | .react-image-marker-popup-content | The editing popup container. | | .react-image-marker-btn-save | The "Save" button. |

License

MIT