
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
solid-sonner
Advanced tools
An opinionated toast component for Solid.
This package tracks the React Sonner API as closely as possible while keeping the implementation Solid-friendly.
npm i solid-sonner
# or
yarn add solid-sonner
# or
pnpm add solid-sonner
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>
)
}
Exports:
ToastertoastuseSonnerAction, ExternalToast, ToastClassnames, ToastT, ToastToDismiss, ToasterPropstoast('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',
},
})
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),
}),
})
const id = toast('Uploading...', { duration: Number.POSITIVE_INFINITY })
toast.success('Done', { id })
toast.dismiss(id)
toast.dismiss()
toast.custom(id => (
<div>
Custom toast <button onClick={() => toast.dismiss(id)}>close</button>
</div>
))
const { toasts } = useSonner()
toast.getToasts()
toast.getHistory()
<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 -> classNameclasses -> classNamesdescriptionClass -> descriptionClassName<>
<Toaster />
<Toaster id="sidebar" position="top-left" />
</>
toast('Global toast')
toast('Sidebar toast', { toasterId: 'sidebar' })
<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',
},
}}
/>
pauseWhenPageIsHidden is available and defaults to Sonner-like hidden-page pausing behaviorcloseButton, dismissible, richColors, testId, and toasterId are supportedaction respects event.preventDefault() and will keep the toast openMIT
FAQs
An opinionated toast component for Solid.
The npm package solid-sonner receives a total of 5,371 weekly downloads. As such, solid-sonner popularity was classified as popular.
We found that solid-sonner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.