▲reactivite
/packages/docs/courses/cli/skillpool/promaster/contact
all docs

$ npm view utoaster

React

utoaster

Ultra-light 3 KB toast/notification system for React + TypeScript. No UI framework required. Tailwind CSS optional.

npm versiondownloads
npm github
$ npm install utoaster

UToaster#

Ultra-light 3KB toast/notification system for React + TypeScript

A minimal, fast, and easy-to-use toast library for React projects. Works without any UI framework. Tailwind CSS optional.


Features#

  • Tiny: ~3KB
  • Simple API: useToast() hook and toast global helper
  • React + TypeScript support
  • Optional Tailwind integration
  • Auto-dismiss toasts
  • Accessible (aria-live polite)

Installation#

npm install utoaster
# or
yarn add utoaster

Peer dependency: React >= 18


Usage#

1. Wrap your app with the provider#

import React from 'react';
import { ToastProvider } from 'utoaster';
import App from './App';

export default function Root() {
  return (
    <ToastProvider>
      <App />
    </ToastProvider>
  );
}

2. Using the useToast hook#

import { useToast } from 'utoaster';

function MyComponent() {
  const { success, error, info, warn } = useToast();

  return (
    <div>
      <button onClick={() => success('Saved successfully!')}>Save</button>
      <button onClick={() => error('Something went wrong!')}>Fail</button>
    </div>
  );
}

3. Using the global toast helper (imperative)#

import { toast } from 'utoaster';

toast.success('Operation completed');
toast.error('Failed to save');

Note: The global toast works anywhere after the ToastProvider is mounted.


Props & Options#

Toast options#

  • type: 'info' | 'success' | 'error' | 'warn' (default 'info')
  • message: string (required)
  • title: string (optional)
  • duration: number in milliseconds (optional, default 4000)

useToast() API#

  • show(toastOptions) → returns toast id
  • success(message, title?, duration?)
  • error(message, title?, duration?)
  • info(message, title?, duration?)
  • warn(message, title?, duration?)

Global toast API#

  • toast.show(toastOptions) → returns toast id
  • toast.success(...), toast.error(...), etc.

Styling#

  • Inline styles included by default for minimal size.
  • Tailwind optional: replace inline styles with Tailwind classes if desired.
  • Toasts appear at bottom-right by default.

TypeScript#

  • Fully typed.
  • ToastProvider, useToast, and toast all have proper types.

License#

MIT

  • home
  • packages
  • skillpool
  • docs
  • cli
▲reactivite

// The fastest way to scaffold production-ready React apps. Built by developers, for developers.

$ npm create reactivite@latest

resources/

  • └─ documentation
  • └─ packages
  • └─ cli
  • └─ courses
  • └─ markdown
  • └─ diff
  • └─ run
  • └─ radio
  • └─ tv
  • └─ games
  • └─ about
  • └─ contact

community/

  • └─ github

© 2026 reactivite — all rights reserved