Toast
š An accessible and beautiful notification library for React.
Install / Use
/learn @pheralb/ToastREADME
<a href="https://toast.pheralb.dev/">Documentation</a> <span>Ā Ā ā¦Ā Ā </span> <a href="https://toast.pheralb.dev/#getting-started">Getting Started</a> <span>Ā Ā ā¦Ā Ā </span> <a href="#-contributing">Contribute</a> <span>Ā Ā ā¦Ā Ā </span> <a href="#-roadmap">Roadmap</a> <span>Ā Ā ā¦Ā Ā </span> <a href="#-license">License</a>
</div> <div align="center"> </div>šŖ Features
- [x] š Lightweight.
- [x] ā Accessible.
- [x] šØ Light, dark & system theme mode.
- [x] ā²ļø Don't close automatically when the user hover over the toast.
- [x] šļø Customizable toast position.
- [x] š Disable transitions if the user has disabled them in the system.
- [x] š Built completely with Typescript.
⨠Inspiration
- [x] šØ Notification Design by Medusa.js UI Framework.
- [x] š ļø Typescript API by Sonner.
- [x] šŖ Phosphor Icons for success, error, warning, info & loading icons.
š Getting Started
[!IMPORTANT] This library requires React v18 or higher.
- Install the library:
# Using npm:
npm install @pheralb/toast
# Using pnpm:
pnpm add @pheralb/toast
# Using yarn:
yarn install @pheralb/toast
- Add the toast provider:
// š root.tsx
import { Toaster } from "@pheralb/toast";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
<Toaster />
</React.StrictMode>,
);
- 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
- [x] š Add
.loadingvariant. - [x] š Add support for Astro + React.
- [x] ⨠Export bundled & minified
.cssfile. - [x] šØ Add support to customize the default styles for greater flexibility and adaptability.
š¤ Contributing
pheralb/toast is a monorepo built with Turbo and it uses:
- Website: Next.js 15 + Content-Collections + MDX + shadcn/ui + Lucide + React-Symbols.
- Library: React 19 with tsup + Lightning CSS + Vitest for testing.
-
Click here to fork the repository.
-
Install dependencies:
# Install pnpm globally if you don't have it:
npm install -g pnpm
# and install dependencies:
pnpm install
- Commands:
# Run only documentation website:
pnpm dev:docs
# Run all website + packages:
pnpm dev
# Build the docs & library:
pnpm build
# Test the library:
pnpm test
š§āš Open http://localhost:3000 to view the Next.js documentation website.
and create a pull request with your features or fixes šāØ.
<a href="https://github.com/pheralb/toast/graphs/contributors"> <img src="https://contrib.rocks/image?repo=pheralb/toast" /> </a>š License
MIT License - pheralb 2024.
