Beta modeInstall commands on this page use
lovdacn@beta, which installs from the beta registry and may change before the stable release.What’s in betaLoading preview…
Sonner is in beta. This component was recently added and will be stabled soon.
Installation
npx lovdacn@latest add sonner(You can also use the shortened lvcn alias, e.g., npx lvcn@latest add sonner)
Registry dependencies: semantic-icon, icon, primitives, utils
Usage
import { ToastProvider, useToast } from "@/components/ui/sonner"
import { Button, Text } from "react-native"
function ToastTrigger() {
const { toast } = useToast();
return (
<Button
title="Show Toast"
onPress={() =>
toast("Notification Title", {
description: "This is a detailed description of the toast action.",
type: "success",
})
}
/>
);
}
export function Example() {
return (
<ToastProvider>
<ToastTrigger />
</ToastProvider>
)
}