āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/dodopayments/billingsdk/components/cancel-subscription/cancel-subscription-dialog ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<Tabs items={['Preview', 'Code']} className="bg-transparent border-none"> <Tab value="Preview" className="border-none bg-transparent p-0 mt-3"> <PreviewComponents registryName="cancel-subscription-dialog"> <CancelSubscriptionDialogDemo /> </PreviewComponents> </Tab>
<Tab value="Code" className="mt-3"> <include cwd lang="tsx" meta='title="src/components/cancel-subscription-dialog-demo.tsx"'>src/components/cancel-subscription-dialog-demo.tsx</include> </Tab> </Tabs><Tabs items={['shadcn', 'billingSDK']} defaultValue="shadcn" className="bg-transparent border-none">
<Tab value="shadcn" className="border-none bg-transparent p-0 mt-3">
<Tabs items={['npx', 'pnpm', 'yarn', 'bun']} defaultValue="npx" groupId="installation-tabs">
<Tab value="npx">
bash npx shadcn@latest add @billingsdk/cancel-subscription-dialog
</Tab>
<Tab value="pnpm">
bash pnpm dlx shadcn@latest add @billingsdk/cancel-subscription-dialog
</Tab>
<Tab value="yarn">
bash yarn dlx shadcn@latest add @billingsdk/cancel-subscription-dialog
</Tab>
<Tab value="bun">
bash bunx shadcn@latest add @billingsdk/cancel-subscription-dialog
</Tab>
</Tabs>
</Tab>
<Tab value="billingSDK" className="border-none bg-transparent p-0 mt-3">
<Tabs items={['npx', 'pnpm', 'yarn', 'bun']} defaultValue="npx" groupId="billingsdk-cli-tabs">
<Tab value="npx">
bash npx @billingsdk/cli add cancel-subscription-dialog
</Tab>
<Tab value="pnpm">
bash pnpm dlx @billingsdk/cli add cancel-subscription-dialog
</Tab>
<Tab value="yarn">
bash yarn dlx @billingsdk/cli add cancel-subscription-dialog
</Tab>
<Tab value="bun">
bash bunx @billingsdk/cli add cancel-subscription-dialog
</Tab>
</Tabs>
</Tab>
</Tabs>
import { CancelSubscriptionDialog } from "@/components/billingsdk/cancel-subscription-dialog";
import { plans } from "@/lib/billingsdk-config";
<CancelSubscriptionDialog
title="We're sorry to see you go..."
description="Before you cancel, let us know what we could do better."
plan={plans[1]}
onCancel={async (planId) => {
// Handle cancellation
await cancelSubscription(planId);
}}
/>
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| title | string | ā
| Main dialog title |
| description | string | ā
| Dialog description text |
| plan | Plan | ā
| Plan object containing subscription details. The plans array in the lib/billingsdk-config.ts file. |
| onCancel | (planId: string) => Promise<void> \| void | ā
| Callback when subscription is cancelled |
| triggerButtonText | string | ā | Text for the trigger button (default: "Cancel Subscription") |
| leftPanelImageUrl | string | ā | Background image URL for left panel |
| warningTitle | string | ā | Title for warning section |
| warningText | string | ā | Warning message text |
| keepButtonText | string | ā | Text for keep subscription button |
| continueButtonText | string | ā | Text for continue cancellation button |
| finalTitle | string | ā | Title for final confirmation step |
| finalSubtitle | string | ā | Subtitle for final confirmation step |
| finalWarningText | string | ā | Final warning message |
| goBackButtonText | string | ā | Text for go back button |
| confirmButtonText | string | ā | Text for final confirm button |
| onKeepSubscription | (planId: string) => Promise<void> \| void | ā | Callback when user keeps subscription |
| onDialogClose | () => void | ā | Callback when dialog is closed |
| className | string | ā | Additional CSS classes |
The cancel subscription dialog component is styled using the shadcn/ui library. You can customize the colors and fonts by overriding the CSS variables. You can also get the theme from the Theming page.
<include cwd lang="tsx" meta='title="src/components/cancel-subscription-dialog-demo.tsx"'>src/components/cancel-subscription-dialog-demo.tsx</include>
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā