0.0.11 • Published 10 months ago

@bgunnarsson/toaster v0.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

@bgunnarsson/toaster for React.

Options

For options refer to the options section in the main readme file.

Usage

Import the hook.

import { useToaster } from '@bgunnarssom/toaster/react';

Initialize the toaster with options

const { toast, dismiss } = useToaster({
  position: 'bottom right',
  offset: { x: 20, y: 20 },
  customClass: 'my-toaster',
})

Regular toast

<button onClick={() => toast({ content: 'This is a text toast!' })}>
  Show Toast
</button>

HTML Toast

<button onClick={() => toast({
  content: '<h1>This is a rich HTML toast!</h1>',
  persist: true,
})}>
  Show Persistent Toast
</button>

Manually dismiss a persisted toast

<button onClick={() => dismiss()}>
  Dismiss Toast
</button>
0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago