Kembali ke eksperimen / Back to lab
Basit Toast
Mei 2021

Basit Toast

a basit (simple) toast like notification

Teknologi yang Digunakan

BASIT TOAST 🔔🔔

a basit (simple) toast like notification 🔔🔔.

Daftar Isi 📚


Instalasi


bash
yarn add basit-toast
bash
npm install basit-toast

BasitToastComponents

jsx
import React, { useState } from 'react' import { BasitToast } from 'basit-toast' import 'basit-toast/dist/basit-toast.css' const ExampleBasitToast = () => { const [openToast, setOpenToast] = useState(false) const handleClick = () => { setOpenToast(true) } return ( <> <BasitToast isOpen={openToast} handleClose={() => setOpenToast(false)} position='bottomcenter' severity='errors' handleCloseDuration={3000} message='Your errors toast here !' /> <button onClick={handleClick}>Click</button> </> ) } export default ExampleBasitToast

useBasitToast

jsx
import React from 'react' import { useBasitToast } from 'basit-toast' import 'basit-toast/dist/basit-toast.css' const ExampleUseBasitToast = () => { const { defaults } = useBasitToast() const handleClick = () => { defaults('Hallo', 'bottomcenter') } return <button onClick={handleClick}>click</button> } export default ExampleUseBasitToast

basittoast

jsx
import React from 'react' import { basittoast } from 'basit-toast' import 'basit-toast/dist/basit-toast.css' const ExampleBasitToast = () => { const handleClick = () => { basittoast.info('HELLO', 'bottomcenter', 3000) } return <button onClick={handleClick}>click</button> } export default ExampleBasitToast

Props

PropsTypeRequired
isOpenbooleantrue
severity ["default", "success", "warning", "errors", "info"]stringtrue
position ["topright", "topleft", "topcenter", "bottomright", "bottomleft", "bottomcenter",]stringtrue
messagestringtrue
handleClosefunctrue
handleCloseDurationnumberfalse

How to Contribute ?


  1. clone this repository
  2. install dependencies
bash
yarn
  1. checkout to new branch
bash
git checkout -B new-feature
  1. modify and push in your branch
  2. add pull request and done.

Licence

MIT.

Bagikan tulisan ini