# Cancellation flow

Guide a consumer-owned keep, pause, or cancellation choice through reason, consequence, retained-access review, and native confirmation.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs guide a consumer-owned keep, pause, or cancellation choice through reason, consequence, retained-access review, and native confirmation.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than cancellation flow.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Cancellation flow

```sh
npx shadcn@latest add @tidal-pro/subscription-cancel
```

Stylesheets: `components/ui/tidal.css`, `components/ui/subscription-cancel.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/subscription-cancel.css";
import{TidalSubscriptionCancel}from"./components/ui/subscription-cancel";
export default(p:Parameters<typeof TidalSubscriptionCancel>[0])=><div className="tidal-scope"><TidalSubscriptionCancel {...p}/></div>;
```

## Structured props

- `TidalSubscriptionCancel.choices: ReadonlyArray<TidalCancellationChoice>`: Required choices value accepted by this exported component.
- `TidalSubscriptionCancel.onChoiceChange: (choiceId: string, event: ChangeEvent<HTMLInputElement>) => void`: Callback invoked when the choice change interaction is proposed.
- `TidalSubscriptionCancel.onConfirmedChange: (confirmed: boolean, event: ChangeEvent<HTMLInputElement>) => void`: Callback invoked when the confirmed change interaction is proposed.
- `TidalSubscriptionCancel.onNoteChange: (note: string, event: ChangeEvent<HTMLTextAreaElement>) => void`: Callback invoked when the note change interaction is proposed.
- `TidalSubscriptionCancel.onReasonChange: (reasonId: string, event: ChangeEvent<HTMLInputElement>) => void`: Callback invoked when the reason change interaction is proposed.
- `TidalSubscriptionCancel.onStepChange: (step: TidalCancellationStep, event: MouseEvent<HTMLButtonElement>) => void`: Callback invoked when the step change interaction is proposed.
- `TidalSubscriptionCancel.reasons: ReadonlyArray<TidalCancellationReason>`: Required reasons value accepted by this exported component.
- `TidalSubscriptionCancel.retainedAccessDate: string`: Required retained access date value accepted by this exported component.
- `TidalSubscriptionCancel.subscriptionLabel: ReactNode`: Required subscription label value accepted by this exported component.
- `TidalSubscriptionCancel.title: ReactNode`: Required title value accepted by this exported component.
- `TidalSubscriptionCancel.value: TidalCancellationValue`: Required value value accepted by this exported component.
- `TidalSubscriptionCancel.backButtonProps?: OwnedButtonProps | undefined`: Optional back button props value accepted by this exported component.
- `TidalSubscriptionCancel.backButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional back button ref value accepted by this exported component.
- `TidalSubscriptionCancel.choiceInputProps?: OwnedRadioProps | undefined`: Optional choice input props value accepted by this exported component.
- `TidalSubscriptionCancel.completion?: ReactNode`: Optional completion value accepted by this exported component.
- `TidalSubscriptionCancel.confirmationInputProps?: OwnedRadioProps | undefined`: Optional confirmation input props value accepted by this exported component.
- `TidalSubscriptionCancel.continueButtonProps?: OwnedButtonProps | undefined`: Optional continue button props value accepted by this exported component.
- `TidalSubscriptionCancel.continueButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional continue button ref value accepted by this exported component.
- `TidalSubscriptionCancel.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalSubscriptionCancel.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalSubscriptionCancel.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalSubscriptionCancel.formProps?: Omit<FormHTMLAttributes<HTMLFormElement>, "aria-disabled" | "children" | "dangerouslySetInnerHTML"> | undefined`: Optional form props value accepted by this exported component.
- `TidalSubscriptionCancel.formRef?: Ref<HTMLFormElement> | undefined`: Optional form ref value accepted by this exported component.
- `TidalSubscriptionCancel.headingLevel?: "h2" | "h3" | "h4" | "h5" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalSubscriptionCancel.labels?: Partial<{ progress: string; reasonStep: string; choiceStep: string; confirmStep: string; completeStep: string; reasonLegend: string; note: string; noteOptional: string; choiceLegend: string; accessUntil: string; consequence: string; confirmation: string; confirmationRequired: string; back: string; continue: string; submit: string; submitting: string; done: string; invalid: string; }> | undefined`: Optional labels value accepted by this exported component.
- `TidalSubscriptionCancel.noteProps?: OwnedTextareaProps | undefined`: Optional note props value accepted by this exported component.
- `TidalSubscriptionCancel.noteRef?: Ref<HTMLTextAreaElement> | undefined`: Optional note ref value accepted by this exported component.
- `TidalSubscriptionCancel.onConfirm?: ((event: FormEvent<HTMLFormElement>) => void) | undefined`: Callback invoked when the confirm interaction is proposed.
- `TidalSubscriptionCancel.pending?: boolean | undefined` (default false): Optional pending value accepted by this exported component.
- `TidalSubscriptionCancel.reasonInputProps?: OwnedRadioProps | undefined`: Optional reason input props value accepted by this exported component.
- `TidalSubscriptionCancel.retainedAccessDisplay?: ReactNode`: Optional retained access display value accepted by this exported component.
- `TidalSubscriptionCancel.submitButtonProps?: OwnedButtonProps | undefined`: Optional submit button props value accepted by this exported component.
- `TidalSubscriptionCancel.submitButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional submit button ref value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/subscription-cancel.tsx) | [Manifest](https://tidalui.com/examples/subscription-cancel.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useState } from "react";

import { TidalSubscriptionCancel, type TidalCancellationStep, type TidalCancellationValue } from "./components/ui/subscription-cancel";

import "./components/ui/subscription-cancel.css";



const tidalExampleStyles = ".tidal-scope .subscription-cancel-demo {\n  display: grid;\n  gap: 12px;\n  inline-size: min(100%, 760px);\n  min-inline-size: 0;\n  margin-inline: auto;\n}\n\n.tidal-scope .subscription-cancel-demo-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 10px;\n  min-inline-size: 0;\n  padding-inline: 5px;\n}\n\n.tidal-scope .subscription-cancel-demo-footer p,\n.tidal-scope .subscription-cancel-demo-note {\n  min-inline-size: 0;\n  margin: 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.45;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .subscription-cancel-demo-footer button {\n  flex: 0 0 auto;\n  min-inline-size: 44px;\n  min-block-size: 44px;\n  border: 0;\n  padding: 8px 10px;\n  background: transparent;\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 11px;\n  font-weight: 760;\n  cursor: pointer;\n}\n\n.tidal-scope .subscription-cancel-demo-footer button:focus-visible {\n  outline: 3px solid var(--t-accent);\n  outline-offset: 2px;\n}\n\n.tidal-scope .subscription-cancel-demo-note {\n  border-block-start: 1px solid var(--t-border);\n  padding: 12px 5px 0;\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .subscription-cancel-demo * {\n    animation: none !important;\n    transition-duration: 0s !important;\n  }\n}";

const REASONS = [
  {
    id: "usage",
    label: "We are not using it enough",
    description: "The sample workspace is quieter than expected.",
  },
  {
    id: "temporary",
    label: "We need a temporary break",
    description: "The team may return after the current project.",
  },
  {
    id: "other",
    label: "Another reason",
    description: "Add optional context below.",
  },
] as const;

const CHOICES = [
  {
    id: "keep",
    label: "Keep the current plan",
    description: "Return to the sample workspace with no prepared change.",
    consequence: "Nothing changes in this preview.",
    retainedAccessApplies: false,
  },
  {
    id: "pause",
    label: "Prepare a pause",
    description: "Record a local pause choice for review.",
    consequence: "A pause choice is prepared locally. No schedule is created.",
  },
  {
    id: "cancel",
    label: "Prepare cancellation",
    description: "Keep access through the supplied date, then stop renewal.",
    consequence:
      "The sample workspace remains available through November 15, 2026. No cancellation is sent.",
  },
] as const;

const INITIAL: TidalCancellationValue = {
  step: "reason",
  reasonId: null,
  note: "",
  choiceId: null,
  confirmed: false,
};

const NEXT: Record<TidalCancellationStep, TidalCancellationStep> = {
  reason: "choice",
  choice: "confirm",
  confirm: "complete",
  complete: "complete",
};

export function SubscriptionCancelDemo() {
  const [value, setValue] = useState<TidalCancellationValue>(INITIAL);
  const [message, setMessage] = useState("Choose a reason to begin.");

  return (
    <div className="subscription-cancel-demo">
      <TidalSubscriptionCancel
        title="Review your workspace plan"
        description="Choose what should happen next and review the exact access date before confirming."
        subscriptionLabel="Sample workspace · Pro"
        retainedAccessDate="2026-11-15"
        retainedAccessDisplay="November 15, 2026"
        reasons={REASONS}
        choices={CHOICES}
        value={value}
        onReasonChange={(reasonId) =>
          setValue((current) => ({ ...current, reasonId }))
        }
        onNoteChange={(note) => setValue((current) => ({ ...current, note }))}
        onChoiceChange={(choiceId) =>
          setValue((current) => ({
            ...current,
            choiceId,
            confirmed: false,
          }))
        }
        onConfirmedChange={(confirmed) =>
          setValue((current) => ({ ...current, confirmed }))
        }
        onStepChange={(step) => {
          setValue((current) => ({ ...current, step }));
          setMessage(
            step === "reason"
              ? "Review the reason."
              : step === "choice"
                ? "Choose a local outcome."
                : "Review the supplied consequence and access date.",
          );
        }}
        onConfirm={(event) => {
          event.preventDefault();
          setValue((current) => ({ ...current, step: NEXT[current.step] }));
          setMessage("Choice prepared locally. No subscription was changed.");
        }}
        completion="The selected outcome was prepared for review. No subscription was changed."
      />
      <div className="subscription-cancel-demo-footer">
        <p role="status" aria-live="polite">
          {message}
        </p>
        <button
          type="button"
          onClick={() => {
            setValue(INITIAL);
            setMessage("Sample flow reset.");
          }}
        >
          Reset
        </button>
      </div>
      <p className="subscription-cancel-demo-note">
        Sample data. Choices stay in this preview and do not affect billing.
      </p>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SubscriptionCancelDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Requires a title, subscription label, valid supplied civil retained-access date, unique nonblank reason/choice IDs, a controlled reason/choice/note/confirmation/step value, and controlled change callbacks. Choice descriptions and consequences are consumer-owned; retainedAccessApplies=false omits the date from both review and final FormData for keep-current outcomes. The confirm step serializes reasonId, note, choiceId, conditional retainedAccessDate and required confirmed=yes in a native form. Native action/method and submitter overrides remain available; consumer form handlers run first, prevention stops higher callbacks, direct submission outside the confirm step or while disabled/pending/invalid is prevented, and onConfirm is optional so native submission can remain primary. Controls own value/default/form/name/type channels, strip unsafe legacy markup, preserve external confirmation descriptions, support native disabled and aria-disabled true/false, and expose direct refs with React 19 cleanup. Synchronously accepted step/complete changes use bounded source-owned focus recovery without stealing unrelated focus. Invalid IDs, dates or controlled selections fail visibly. Error, pending, completion, numeric ReactNode content, h2-h5 hierarchy, RTL, 180/320/390 widths, 44px actions, 16px narrow notes, reduced motion and forced colors are supported. Consumers own authentication, authorization, billing, scheduling, persistence and every subscription outcome; the component changes no plan and sends no request.
