npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

solid-sonner

v0.3.1

Published

An opinionated toast component for Solid.

Readme

solid-sonner

pnpm

An opinionated toast component for Solid.

This package tracks the React Sonner API as closely as possible while keeping the implementation Solid-friendly.

Install

npm i solid-sonner
# or
yarn add solid-sonner
# or
pnpm add solid-sonner

Quick start

import { Toaster, toast } from 'solid-sonner'

export default function App() {
  return (
    <div>
      <Toaster />
      <button onClick={() => toast('My first toast')}>Give me a toast</button>
    </div>
  )
}

API

Exports:

  • Toaster
  • toast
  • useSonner
  • types: Action, ExternalToast, ToastClassnames, ToastT, ToastToDismiss, ToasterProps

Toast types

toast('Event has been created')
toast.success('Event has been created')
toast.info('Event has new information')
toast.warning('Event has warning')
toast.error('Event has not been created')
toast.loading('Loading data')

With description, icon, and actions:

toast('Event has been created', {
  description: 'Monday, January 3rd at 6:00pm',
  icon: <MyIcon />,
  action: {
    label: 'Undo',
    onClick: () => console.log('Undo'),
  },
  cancel: {
    label: 'Cancel',
  },
})

Promise toasts

toast.promise(fetchData(), {
  loading: 'Loading...',
  success: data => `${data.name} has been added!`,
  error: 'Error',
})

Extended results are supported too:

toast.promise(saveProject(), {
  loading: 'Saving...',
  success: result => ({
    message: 'Project saved',
    description: result.id,
  }),
  error: error => ({
    message: 'Save failed',
    description: String(error),
  }),
})

Updating and dismissing

const id = toast('Uploading...', { duration: Number.POSITIVE_INFINITY })

toast.success('Done', { id })
toast.dismiss(id)
toast.dismiss()

Headless custom toasts

toast.custom(id => (
  <div>
    Custom toast <button onClick={() => toast.dismiss(id)}>close</button>
  </div>
))

Read current state

const { toasts } = useSonner()

toast.getToasts()
toast.getHistory()

Toaster props

<Toaster
  theme="system"
  position="top-right"
  richColors
  closeButton
  expand
  visibleToasts={5}
  duration={5000}
  gap={14}
  offset={32}
  mobileOffset={{ bottom: 24, left: 16, right: 16 }}
  hotkey={['altKey', 'KeyT']}
  dir="auto"
  swipeDirections={['top', 'right']}
  containerAriaLabel="Notifications"
  toastOptions={{
    className: 'my-toast',
    descriptionClassName: 'my-toast-description',
    closeButtonAriaLabel: 'Close notification',
    classNames: {
      toast: 'toast',
      title: 'title',
      description: 'description',
    },
  }}
/>

Legacy aliases from older solid-sonner versions still work for compatibility:

  • class -> className
  • classes -> classNames
  • descriptionClass -> descriptionClassName

Multiple toasters

<>
  <Toaster />
  <Toaster id="sidebar" position="top-left" />
</>

toast('Global toast')
toast('Sidebar toast', { toasterId: 'sidebar' })

Tailwind / unstyled mode

<Toaster
  toastOptions={{
    unstyled: true,
    classNames: {
      toast: 'bg-blue-500 text-white',
      title: 'font-semibold',
      description: 'text-blue-100',
      actionButton: 'bg-white text-blue-700',
      cancelButton: 'bg-blue-700 text-white',
      closeButton: 'bg-white text-black',
    },
  }}
/>

Notes

  • pauseWhenPageIsHidden is available and defaults to Sonner-like hidden-page pausing behavior
  • Per-toast closeButton, dismissible, richColors, testId, and toasterId are supported
  • action respects event.preventDefault() and will keep the toast open

License

MIT