UNPKG

@arashaltafi/react-toast

Version:
51 lines (35 loc) 1.19 kB
# My Toast Library A Simple Toast & Tooltip Library, Built With React and TypeScript. ## Installation ```bash npm install react-toast ``` ## Usage ```typescript import { showToast } from '@arashaltafi/react-toast'; import { Tooltip } from '@arashaltafi/react-toast'; // show 'error' Toast showToast('Error Toast Message', 'error', true, 5000) // show 'success' Toast showToast('Success Toast Message', 'success', true, 5000) // show Tooltip <Tooltip content="This is a tooltip"> <p>1</p> <p>2</p> <p>3</p> </Tooltip> ``` ## Parameter Toast | Parameter | Type | Description | | :-------- | :------- | :------------------------- | | `text` | `string` | **Required** | | `color` | `"success" or "error"` | **Required** | | `pauseOnHover` | `boolean` | *Default false* | | `timeWait` | `number` | *Default 3000 ms* | ## Parameter Tooltip | Parameter | Type | Description | | :-------- | :------- | :------------------------- | | `children` | `children React Node` | **Required** | | `content` | `"string"` | **Required** | ## License [MIT](https://choosealicense.com/licenses/mit/)