mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
- Fix 3D card component demos with proper content in both default and new-york themes - Update all 170+ CLI installation commands from 'npx hanzo-ui@latest' to 'npx @hanzo/ui@latest' - Update CLAUDE.md to reflect correct package naming - Rebuild component registry with updated demos
102 lines
1.6 KiB
Plaintext
102 lines
1.6 KiB
Plaintext
---
|
|
title: Sonner
|
|
description: An opinionated toast component for React.
|
|
component: true
|
|
links:
|
|
doc: https://sonner.emilkowal.ski
|
|
---
|
|
|
|
<ComponentPreview name="sonner-demo" />
|
|
|
|
## About
|
|
|
|
Sonner is built and maintained by [emilkowalski\_](https://twitter.com/emilkowalski_).
|
|
|
|
## Installation
|
|
|
|
<Tabs defaultValue="cli">
|
|
|
|
<TabsList>
|
|
<TabsTrigger value="cli">CLI</TabsTrigger>
|
|
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
</TabsList>
|
|
<TabsContent value="cli">
|
|
|
|
<Steps>
|
|
|
|
<Step>Run the following command:</Step>
|
|
|
|
```bash
|
|
npx @hanzo/ui@latest add sonner
|
|
```
|
|
|
|
<Step>Add the Toaster component</Step>
|
|
|
|
```tsx title="app/layout.tsx" {1,9}
|
|
import { Toaster } from "@/components/ui/sonner"
|
|
|
|
export default function RootLayout({ children }) {
|
|
return (
|
|
<html lang="en">
|
|
<head />
|
|
<body>
|
|
<main>{children}</main>
|
|
<Toaster />
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|
|
```
|
|
|
|
</Steps>
|
|
|
|
</TabsContent>
|
|
|
|
<TabsContent value="manual">
|
|
|
|
<Steps>
|
|
|
|
<Step>Install the following dependencies:</Step>
|
|
|
|
```bash
|
|
npm install sonner next-themes
|
|
```
|
|
|
|
<Step>Copy and paste the following code into your project.</Step>
|
|
|
|
<ComponentSource name="sonner" />
|
|
|
|
<Step>Add the Toaster component</Step>
|
|
|
|
```tsx title="app/layout.tsx" {1,9}
|
|
import { Toaster } from "@/components/ui/sonner"
|
|
|
|
export default function RootLayout({ children }) {
|
|
return (
|
|
<html lang="en">
|
|
<head />
|
|
<body>
|
|
<main>{children}</main>
|
|
<Toaster />
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|
|
```
|
|
|
|
</Steps>
|
|
|
|
</TabsContent>
|
|
|
|
</Tabs>
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
import { toast } from "sonner"
|
|
```
|
|
|
|
```tsx
|
|
toast("Event has been created.")
|
|
```
|