Snackbar
Brief message that appears at the edge of the screen and dismisses itself.
Installation
bun add @xerobi/ui
import { Snackbar } from "@xerobi/ui/snackbar"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
import { Button } from "@xerobi/ui/button"
import { toast } from "@xerobi/ui/snackbar"
export function SnackbarDefault() {
return (
<div className="flex flex-wrap gap-2">
<Button variant="outline" onClick={() => toast("Project created")}>Give me a toast</Button>
<Button variant="outline" onClick={() => toast.success("Changes saved")}>Success</Button>
<Button variant="outline" onClick={() => toast.error("Could not save")}>Error</Button>
</div>
)
}API reference
Snackbar
Toast outlet. Mount once near the root, then call `toast.success("Saved")` (re-exported from sonner). Styles live in styles/snackbar.css and follow the theme tokens.
No props of its own.
Hooks
useSonner