Files
cosscom__coss/apps/ui/public/r/toast-with-action.json
Volnei Munhoz d5a915e6d0 add biome
2025-11-13 19:19:31 -03:00

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"]
}