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

simple-tailwind-toast

v2.0.0

Published

A lightweight, providerless React toast library styled with Tailwind CSS classes.

Readme

Simple Tailwind Toast

A lightweight, providerless toast library for React 18+ apps. It ships plain React components and Tailwind class presets, not generated CSS.

Why

  • No runtime dependencies.
  • No provider or context setup.
  • No CSS injection and no bundled Tailwind reset.
  • Fully customizable through Tailwind classes, data attributes, or a custom renderer.
  • SSR-safe imports.

Install

npm install simple-tailwind-toast
yarn add simple-tailwind-toast

Tailwind Setup

The package does not ship CSS. If you use the default class presets, make sure Tailwind scans the installed package.

Tailwind v4:

@import "tailwindcss";

@source "../node_modules/simple-tailwind-toast/dist";

Use the v4 @import form above. The older @tailwind base; @tailwind components; @tailwind utilities; directives can miss theme-backed utility classes in v4 projects.

Tailwind v3:

export default {
  content: [
    './index.html',
    './src/**/*.{js,ts,jsx,tsx}',
    './node_modules/simple-tailwind-toast/dist/**/*.{js,mjs,cjs}',
  ],
};

Quick Start

import { Toaster, toast } from 'simple-tailwind-toast';

export function App() {
  return (
    <>
      <button
        onClick={() =>
          toast.success('Saved', {
            description: 'Your changes are live.',
          })
        }
      >
        Show toast
      </button>

      <Toaster position="top-right" />
    </>
  );
}

API

toast('Message');
toast({ title: 'Message', description: 'More detail' });

toast.success('Saved', options);
toast.error('Failed', options);
toast.warning('Check this', options);
toast.info('Heads up', options);

toast.dismiss(id);
toast.clear();

Every toast.* call returns the toast id. Passing an existing id updates that toast instead of creating a duplicate.

const id = toast.info('Uploading', {
  description: '0%',
  duration: false,
});

toast.success('Upload complete', {
  id,
  description: '100%',
  duration: 3000,
});

Options

type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info';
type ToastPosition =
  | 'top-left'
  | 'top-center'
  | 'top-right'
  | 'bottom-left'
  | 'bottom-center'
  | 'bottom-right';

type ToastOptions = {
  id?: string;
  title?: React.ReactNode;
  description?: React.ReactNode;
  type?: ToastType;
  duration?: number | false;
  dismissible?: boolean;
  className?: string;
  onDismiss?: (toast: ToastRecord) => void;
};

duration is in milliseconds. The default is 4000; use duration: false for persistent toasts.

Customization

Use classNames to replace any slot class. The default classes are exported as toastClasses.default if you want to copy and adjust them.

import { Toaster, toastClasses } from 'simple-tailwind-toast';

<Toaster
  classNames={{
    ...toastClasses.default,
    toast:
      'pointer-events-auto rounded-md border bg-zinc-950 p-4 text-sm text-white shadow-lg',
    variants: {
      ...toastClasses.default.variants,
      success: 'border-emerald-400',
      error: 'border-red-400',
    },
  }}
/>;

You can also target attributes:

[data-type="success"] {
  border-color: var(--color-emerald-400);
}

For full control, pass renderToast.

<Toaster
  renderToast={(toast, { dismiss }) => (
    <div>
      <strong>{toast.title}</strong>
      <button onClick={dismiss} type="button">
        Close
      </button>
    </div>
  )}
/>

Toaster Props

type ToasterProps = {
  position?: ToastPosition;
  duration?: number | false;
  maxToasts?: number;
  classNames?: ToastClassNames;
  icons?: Partial<Record<ToastType, React.ReactNode>>;
  renderToast?: (toast: ToastRecord, helpers: { dismiss: () => void }) => React.ReactNode;
};

Bundle

The package externalizes React and contains no CSS-in-JS runtime, no Tailwind compiler output, and no class-merging dependency. The current production ESM build is about 2.61 KB gzip excluding source maps, and the dry-run npm package is about 15.7 KB packed.

Development

corepack enable
yarn install
yarn test
yarn typecheck
yarn build

Use yarn pack:dry before release changes to verify the files that will be published.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening larger pull requests, see CHANGELOG.md for release notes, and report vulnerabilities through SECURITY.md.

License

MIT