@a7medhassan/react-toast
TypeScript icon, indicating that this package has built-in type declarations

0.0.20 • Public • Published

@a7medhassan/react-toast

@a7medhassan/react-toast

An enterprise-class React UI library made with ❤️ by a7medhassan.

📦 Install

npm install  @a7medhassan/react-toast
yarn add  @a7medhassan/react-toast
pnpm add @a7medhassan/react-toast

🔨 Usage

warp you entire app with ToastProvider

import React from "react";
import {ToastProvider} from "@a7medhassan/react-toast"
const App = () => (
	<ToastProvider>
		<UIComponent />
	</ToastProvider>
);

then in any component inside the wrapper you can use useReactToast hook

import React from "react";
import { useReactToast } from '@a7medhassan/react-toast'
const Components = () => (
  const {addToast}=useReactToast()
  function fireToast(){
    addToast({
    type: "success" , // "success"| "info" | "warning" | "error"
    message: "your message",
    duration: 1000, //your duration
    position: "topLeft",//  | "topLeft"| "topCenter"| "topRight"| "bottomRight"| "bottomCenter"| "bottomLeft"
    icon: true     //ReactNode | boolean; optional
    })
  }
	<div>
		<button onClick={fireToast}>click</button>
	</div>
);

TypeScript

@a7medhassan/react-toast is written in TypeScript with complete definitions.

Package Sidebar

Install

npm i @a7medhassan/react-toast

Weekly Downloads

0

Version

0.0.20

License

MIT

Unpacked Size

60.2 kB

Total Files

23

Last publish

Collaborators

  • a7medhassanmohi