{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"c-sonner-7","type":"registry:block","title":"Promise toast with loading state","description":"Promise toast with loading state","dependencies":["sonner"],"registryDependencies":["button"],"files":[{"path":"c-sonner-7.tsx","type":"registry:block","content":"import { toast } from \"sonner\"\n\nimport { Button } from \"@/components/ui/button\"\n\nexport function Pattern() {\n  const handleDeploy = () => {\n    toast.promise(\n      new Promise<{ name: string }>((resolve) =>\n        setTimeout(() => resolve({ name: \"production\" }), 2000)\n      ),\n      {\n        loading: \"Deploying to production...\",\n        success: (data) => `Deployed to ${data.name} successfully`,\n        error: \"Deployment failed. Please try again.\",\n      }\n    )\n  }\n\n  return (\n    <div className=\"flex items-center justify-center\">\n      <Button onClick={handleDeploy} variant=\"outline\" className=\"w-fit\">\n        Deploy\n      </Button>\n    </div>\n  )\n}","target":"components/examples/c-sonner-7.tsx"}],"meta":{"order":7}}