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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cy-toast

v1.0.11

Published

A lightweight React toast/snackbar UI component for notifications.

Readme

📜 cy-toast

코드잇 중급 프로젝트용 toast/snackbar 라이브러리 패키지입니다.

✨ Features

  • headless ui로 자유로운 커스터마이징 제공
  • React 기반 lightweight toast 시스템
  • open/close 애니메이션을 위한 상태 값 제공
  • 각 Toast의 순서를 기반으로 애니메이션 커스터마이징 가능
  • 수동/자동 닫기 지원 (duration=0으로 무한 지속 가능)

💡 Install

npm install cy-toast

🔨 Usage

1. ToastRender 루트 컴포넌트 등록

// RootLayout.tsx or toast 사용할 컴포넌트에 ToastRender 컴포넌트 등록
import { ToastRender } from 'cy-toast';

const TestComponent = () => {
  return (
    <ToastRender/> {/*ToastRender 컴포넌트 추가*/}
    <Page/>
  )
}

2. 토스트 사용 (기본 텍스트)

import { toast } from 'cy-toast';

toast.run(
  ({ close }) => (
    <div className="toast">
      저장되었습니다! <button onClick={close}>닫기</button>
    </div>
  ),
  { duration: 3000 }
);

3. 토스트 사용 (사용자 정의 컴포넌트)

import { toast } from 'cy-toast';
import clsx from 'clsx';

toast.run(
  ({ close, isClosing, isOpening, index }) => (
    <div
      className={clsx(
        'toast-base',
        isClosing &&
          index < 3 &&
          'animation-slide-down-out pointer-events-none',
        isOpening && 'animation-slide-down-in',
        index === 1 && 'translate-y-[10px] scale-90',
        index === 2 && 'translate-y-[15px] scale-80',
        index >= 3 && 'translate-y-[20px] scale-70 opacity-0'
      )}
    >
      <Icon />내 위키 링크가 복사되었습니다.
      <button onClick={close}>닫기</button>
    </div>
  ),
  { duration: 10000 }
);

🚀 API

| 매개변수 | 타입 | 설명 | | --------- | ---------------------------------------------------------------------- | --------------------------------------------------------- | | content | (context: ToastContext) => React.ReactNode | 표시할 토스트 JSX를 반환하는 함수 | | options | { duration?: number; closeDuration?: number; openDuration?: number } | 애니메이션 및 유지 시간 옵션 (0 지정 시 자동 종료 없음) |

🧩 ToastContext 타입 토스트 컨텐츠에 전달되는 객체는 다음과 같은 구조입니다.

interface ToastContext {
  close: () => void; // 수동 닫기 함수
  isClosing: boolean; // 닫히는 중 여부 (true면 닫히는 애니메이션)
  isOpening: boolean; // 열리는 중 여부 (true면 열리는 애니메이션)
  index: number; // 토스트 표시 순서 (최신이 0)
}

🧪 예제

toast.run(({ close, isOpening, isClosing, index }) => (
  <div
    className={clsx(
      'toast-base',
      isOpening && 'fade-in',
      isClosing && 'fade-out',
      index === 1 && 'translate-y-[10px]',
      index >= 2 && 'translate-y-[20px] opacity-80'
    )}
  >
    토스트 메시지입니다!
    <button onClick={close}>닫기</button>
  </div>
));