1.2.6 • Published 2 years ago

toasti-desk v1.2.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

toasti-desk

toasti-desk is a library for non-blocking notifications . The goal is to create a simple core library that can be customized and extended.

Install

npm

npm install --save toasti-desk

yarn

yarn add toasti-desk

use

wrap your main component into the ToastContextProvider

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import './index.css';
import { ToastContextProvider } from 'toasti-desk';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <ToastContextProvider>
      <App />
    </ToastContextProvider>
  </React.StrictMode>
);
import React from 'react';
import { ToastiDesk, useToast } from 'toasti-desk';
import '../node_modules/toasti-desk/dist/style.css';

const App: React.FC = () => {
  const toast = useToast();

  const handelClick = () => {
    toast.error('Success toast notification', { position: 'bottom-left' });
  };
  return (
    <>
      <button onClick={handelClick} className='px-3 py-1 border rounded-md shadow-md'>
        Success{' '}
      </button>
      <ToastiToast />
    </>
  );
};

export default App;

Add dependency

// Add tailwindcss on applications
//tailwindcss.com/

https: configuration;

tsconfig.json;

export default {
  content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}', './node_modules/toasti-desk/**/*.{html,js,ts,jsx,tsx}'],
};

Quick Start

// Display a warning toast, with no title
toasti.warning('confirm you want to delete message');

// Display a success toast, with a title
toasti.success('login successfull');

// Display an error toast, with a title
toasti.error('something wrong');

// Override global options
toasti.info('refresh the page');

Delay

The delay value determines how long this notification appears on screen before it disappears. The default value is 0 seconds (5000ms). You can alter this to any number you wish.

toasti.success('We do have the Kapua suite available.', { timer: 5000 });

Position

By default, the position is set to bottom-right. However you can alter this to one of the following if you wish: top-left, top-right, bottom-left, bottom-right, center,top-center, bottom-center, left-center, right-center.

toasti.success('We do have the Kapua suite available.', { position: 'bottom-left' });
toasti.success('We do have the Kapua suite available.', { position: 'bottom-left', timer: 5000 });

Dependencies

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago