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

@junseok816/react-image-labeler

v0.1.1

Published

React image labeling component for drawing, selecting, moving, and resizing bounding boxes on a single image.

Readme

@junseok816/react-image-labeler

단일 이미지를 대상으로 바운딩 박스 라벨링을 수행할 수 있는 React 컴포넌트입니다.

설치

npm install @junseok816/react-image-labeler

앱에서 번들된 스타일시트를 한 번만 import 해주세요.

import "@junseok816/react-image-labeler/style.css";

사용 예시

import { useMemo, useState } from "react";
import ImageLabeler, {
  type ImageLabelerBoxInput,
  type ImageLabelerChange,
} from "@junseok816/react-image-labeler";
import "@junseok816/react-image-labeler/style.css";

type Item = {
  id: string;
  src: string;
  name: string;
};

export default function Example({ images }: { images: Item[] }) {
  const [currentIndex, setCurrentIndex] = useState(0);
  const [labelsByImage, setLabelsByImage] = useState<Record<string, ImageLabelerBoxInput[]>>({});
  const [categories, setCategories] = useState(["fish", "other"]);

  const currentImage = images[currentIndex] ?? null;
  const currentValue = useMemo(() => {
    if (!currentImage) return [];
    return labelsByImage[currentImage.id] ?? [];
  }, [currentImage, labelsByImage]);

  const handleChange = (next: ImageLabelerChange) => {
    if (!next.imageId) return;

    setCategories(next.categories);
    setLabelsByImage((prev) => ({
      ...prev,
      [next.imageId]: next.value.map((box) => ({
        id: box.id,
        label: box.label,
        x: box.pixel.x,
        y: box.pixel.y,
        w: box.pixel.w,
        h: box.pixel.h,
      })),
    }));
  };

  return (
    <ImageLabeler
      image={
        currentImage
          ? {
              id: currentImage.id,
              src: currentImage.src,
              name: currentImage.name,
            }
          : null
      }
      value={currentValue}
      categories={categories}
      onChange={handleChange}
      style={{ minHeight: 760 }}
    />
  );
}

Props

  • image: 현재 라벨링할 이미지입니다. 한 번에 한 장만 전달합니다.
  • value: 현재 이미지에 대한 박스 목록입니다. 좌표는 px 기준입니다.
  • categories: 선택 가능한 라벨 카테고리 목록입니다.
  • onChange: 박스, 카테고리, 선택 상태가 바뀔 때 호출됩니다.
  • className: 루트 요소에 추가할 선택적 className입니다.
  • style: 루트 요소에 적용할 선택적 inline style입니다.

onChange 반환값

  • image: 현재 이미지 메타데이터
  • imageId: 현재 이미지 ID
  • value: pixel 좌표와 normalized 좌표를 함께 포함한 현재 이미지 박스 목록
  • categories: 현재 카테고리 목록
  • selectedBoxId: 선택된 박스 ID 또는 null
  • naturalSize: 로드된 이미지의 원본 너비/높이

참고

  • 여러 이미지를 다룰 경우 상위 앱이 현재 인덱스와 이미지별 라벨 상태를 관리하고, 이 컴포넌트에는 현재 이미지 한 장만 전달하는 방식이 적합합니다.
  • 이 패키지는 데이터셋 페이지 이동, 저장, 서버 동기화 같은 외부 상태 관리는 직접 처리하지 않습니다.
  • 현재 예시는 @junseok816/react-image-labeler 기준입니다. 다른 계정이나 이름으로 배포할 예정이면 package.json과 import 예시를 함께 수정하세요.