0.0.11 • Published 9 months ago

@bgunnarsson/toaster v0.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
9 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

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago