Skip to content
/ toast Public

🍞 An accessible and beautiful notification library for React.

License

Notifications You must be signed in to change notification settings

pheralb/toast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

@pheralb/toast

An accessible toast library for React.

Documentation   ✦   Getting Started   ✦   Contribute   ✦   Roadmap   ✦   License

React Badge Astro Badge Vitest Badge GitHub releases npm bundle size Build Status GitHub stars GitHub issues

πŸͺ Features

  • πŸ‚ Lightweight.
  • βœ… Accessible.
  • 🎨 Light/dark mode.
  • ⏲️ Don't close automatically when the user hover over the toast.
  • πŸ—οΈ Customizable toast position.
  • πŸƒ Disable transitions if the user has disabled them in the system.
  • πŸ’™ Built completely with Typescript.

✨ Inspiration

πŸš€ Getting Started

Important

This library requires React v18 or higher.

  1. Install the library:
# Using npm:
npm install @pheralb/toast

# Using pnpm:
pnpm add @pheralb/toast

# Using yarn:
yarn install @pheralb/toast
  1. Add the toast provider:
// πŸ“ƒ root.tsx

import { Toaster } from '@pheralb/toast';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <App />
    <Toaster />
  </React.StrictMode>,
);
  1. Usage:
// πŸ“ƒ index.tsx

import { toast } from '@pheralb/toast';

export default function Index() {
  return (
    <>
      <button
        onClick={() =>
          toast.success({
            text: 'pheralb/toast',
            description: '✨ A beautiful toast library for React',
          })
        }
      >
        <span>Render a toast</span>
      </button>
    </>
  );
}

Tip

πŸ“š Visit the Documentation for more information.

πŸ”­ Roadmap

  • πŸš— Add .loading variant.
  • πŸ“š Add support for Astro + React.
  • 🎨 Add rich colors support.

🀝 Contributing

pheralb/toast is a monorepo built with Turbo and it uses:

  • Docs: Astro Content Collections, shadcn/ui + Tailwind CSS & MDX.
  • Library: React 18 with tsup + Vitest for testing.
  • Examples: Frameworks to test the library.
  1. Click here to fork the repository.

  2. Install dependencies:

# Install pnpm globally if you don't have it:
npm install -g pnpm

# and install dependencies:
pnpm install
  1. Commands:
# Run only documentation website:
pnpm dev:docs

# Run all packages with examples:
pnpm dev

# Build the docs & library:
pnpm build

# Test the library:
pnpm test

and create a pull request with your features or fixes πŸš€βœ¨.

πŸ“ƒ License

MIT License - pheralb 2024.