Skip to content

Getting Started

This guide will help you get started with Somoto. Sonner is good. So i think there should be a toast library for SolidJS.

Install

Terminal window
pnpm i somoto

Add Toaster to your app

It can be placed anywhere, even in server components such as layout.tsx.

import { Toaster } from 'somoto';
export default function RootLayout({ children }: { children: JSX.Element }) {
return (
<html lang="en">
<body>
{children}
<Toaster />
</body>
</html>
);
}

Render a toast

import { toast } from 'somoto';
function MyToast() {
return <button onClick={() => toast('This is a somoto toast')}>Render my toast</button>;
}