mirror of
https://github.com/cosscom/coss.git
synced 2026-09-14 20:06:50 +08:00
16 lines
1.3 KiB
JSON
16 lines
1.3 KiB
JSON
{
|
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
"name": "toast-with-action",
|
|
"type": "registry:example",
|
|
"description": "Toast with an action button",
|
|
"registryDependencies": ["@coss/toast"],
|
|
"files": [
|
|
{
|
|
"path": "registry/default/examples/toast-with-action.tsx",
|
|
"content": "\"use client\"\n\nimport { Button } from \"@/registry/default/ui/button\"\nimport { toastManager } from \"@/registry/default/ui/toast\"\n\nexport default function ToastWithAction() {\n return (\n <Button\n variant=\"outline\"\n onClick={() => {\n const id = toastManager.add({\n title: \"Action performed\",\n description: \"You can undo this action.\",\n type: \"success\",\n actionProps: {\n children: \"Undo\",\n onClick: () => {\n toastManager.close(id)\n toastManager.add({\n title: \"Action undone\",\n description: \"The action has been reverted.\",\n type: \"info\",\n })\n },\n },\n timeout: 1000000,\n })\n }}\n >\n Perform Action\n </Button>\n )\n}\n",
|
|
"type": "registry:example"
|
|
}
|
|
],
|
|
"categories": ["toast", "button"]
|
|
}
|