Socket
Socket
Sign inDemoInstall

@jill64/svelte-toast

Package Overview
Dependencies
220
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jill64/svelte-toast

🍞 Pre-Themed Responsive Toast Notification


Version published
Weekly downloads
23K
decreased by-47.69%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@jill64/svelte-toast

npm-version npm-license npm-download-month npm-min-size ci.yml website

🍞 Pre-Themed Responsive Toast Notification

Demo

This library is a personal extension of svelte-french-toast

  • Color palette makes theme setting quick and simple
  • Applies device dark theme by default
  • Most of the original methods are available

Installation

npm i @jill64/svelte-toast

Usage

<!-- +layout.svelte -->
<script>
  import { Toaster } from '@jill64/svelte-toast'

  // Optional Color Palette
  $: palette = {
    background: '#EEE',
    text: '#000',
    success: '#29cf60',
    error: '#cf3d29',
    secondary: '#FFF',
    loading: '#BBB'
  }
</script>

<Toaster {palette} />
<!-- ... -->
<slot />
<!-- ... -->
<!-- +page.svelte -->
<script>
  import { toast } from '@jill64/svelte-toast'

  const onSuccess = () => $toast.success('Success', {
    // Optional Toast Config
  })

  const onError= () => $toast.error('Error', {
    // Optional Toast Config
  })

  const onPromise = () =>
    $toast.promise(
      // Your Promise
      ,
      {
        success: 'Success',
        error: 'Error',
        loading: 'Loading'
      },
      {
        // Optional Toast Config
      }
    )
</script>

<button on:click={onSuccess}> Success </button>
<button on:click={onError}> Error </button>
<button on:click={onPromise}> Promise </button>

License

MIT

Keywords

FAQs

Last updated on 01 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc