snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
50
apps/v4/registry/bases/base/examples/sonner-example.tsx
Normal file
50
apps/v4/registry/bases/base/examples/sonner-example.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
"use client"
|
||||
|
||||
import { toast } from "sonner"
|
||||
|
||||
import {
|
||||
Example,
|
||||
ExampleWrapper,
|
||||
} from "@/registry/bases/base/components/example"
|
||||
import { Button } from "@/registry/bases/base/ui/button"
|
||||
|
||||
export default function SonnerExample() {
|
||||
return (
|
||||
<ExampleWrapper>
|
||||
<SonnerBasic />
|
||||
<SonnerWithDescription />
|
||||
</ExampleWrapper>
|
||||
)
|
||||
}
|
||||
|
||||
function SonnerBasic() {
|
||||
return (
|
||||
<Example title="Basic" className="items-center justify-center">
|
||||
<Button
|
||||
onClick={() => toast("Event has been created")}
|
||||
variant="outline"
|
||||
className="w-fit"
|
||||
>
|
||||
Show Toast
|
||||
</Button>
|
||||
</Example>
|
||||
)
|
||||
}
|
||||
|
||||
function SonnerWithDescription() {
|
||||
return (
|
||||
<Example title="With Description" className="items-center justify-center">
|
||||
<Button
|
||||
onClick={() =>
|
||||
toast("Event has been created", {
|
||||
description: "Monday, January 3rd at 6:00pm",
|
||||
})
|
||||
}
|
||||
variant="outline"
|
||||
className="w-fit"
|
||||
>
|
||||
Show Toast
|
||||
</Button>
|
||||
</Example>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user