[Components](https://oods-foundry.com/components) / lifecycle

# CancellationForm

Collects a cancellation reason and code.

Generated from @oods/foundry 0.10.1

- Categories

  lifecycle

- Contexts

  form

- Readiness

  `proven-in-generated-apps`

## Playground

This component's contract doesn't list typed props, so the playground shows its documented example.

Documented example `cancellation-form-presentational-controls` : mount, reason and code retain their initial values; native controls are labelled; submit does not cancel or save.

The render follows the page's theme switch: light, dark or high contrast. Both frameworks render the same example.

The real CancellationForm, live

React

Vue

## Code

The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.

**React**

```
import { CancellationForm } from '@oods/components-react';
import '@oods/component-styles/css';

export function Example() {
  return (
    <CancellationForm
      title="Cancellation request"
      reasonCode="budget"
      reason="Costs changed"
    />
  );
}
```

## Props, slots and events

Contract version 1.1.0. Types are from the React declarations in @oods/components-react.

Props

| Prop | Type | Required | Documented example |
| - | - | - | - |
| `embedded` | `boolean \| undefined` | no | |
| `reasonHelp` | `string \| undefined` | no | |
| `codeHelp` | `string \| undefined` | no | |
| `title` | `string \| undefined` | no | `Cancellation request` |
| `label` | `string \| undefined` | no | |
| `heading` | `string \| undefined` | no | |
| `name` | `string \| undefined` | no | |
| `description` | `string \| undefined` | no | |
| `subtitle` | `string \| undefined` | no | |
| `hint` | `string \| undefined` | no | |
| `allowedReasons` | `readonly unknown[] \| undefined` | no | |
| `reasonCode` | `string \| undefined` | no | `budget` |
| `reason` | `string \| undefined` | no | `Costs changed` |
| `cancellationReason` | `string \| undefined` | no | |

### Slots

default

### Events

none

## States

populated, empty

## Accessibility

- Role

  `textbox`

- How it gets its name

  `label` on `textarea[name="reason"]`

### Keyboard

Keyboard

| Key | What it does |
| - | - |
| `Tab` | Move focus to the named native control |
| `x` | Edit the named control |

### Obligations in the contract

- reason and code retain their initial values
- native controls are labelled
- submit does not cancel or save

Mirrors renderCancellationForm: title/label/heading/name (default Cancellation Form), description/subtitle/hint subtitle; labelled Reason Code select and Reason textarea, reason/cancellationReason precedence, allowedReasons with no_longer_needed/budget/duplicate defaults; an explicitly empty list permits a text code, and an existing code absent from finite options is preserved as an option. embedded uses a fieldset within a host form. reasonHelp and codeHelp remain below their controls. Children replace controls and retain the header. reasonField and codeField lower to reason and reasonCode. requireReasonParameter, allowedReasonsParameter and windowParameter are consumed unbound. Presentational native controls only; submission is prevented and no cancel/save event or persistence is implemented.

## Tokens

The token roles this component reads.

- `form.background`
- `form.border`
- `form.text`
- `form.hint`

## Readiness

The evidence recorded for this component, with its label.

`proven-in-generated-apps`: catalog_list gives this label when generated React and Vue apps in the runtime sweep that ships with this version both use the component. That sweep was measured on the published 0.4.1, not on this version.

Readiness evidence

| Evidence | React | Vue |
| - | - | - |
| state | implemented-evidence-complete | implemented-evidence-complete |
| versioned contract | passed | passed |
| target implementation | passed | passed |
| package export | passed | passed |
| public declaration | passed | passed |
| dependency closure | passed | passed |
| framework scenario | passed | passed |
| accessibility | verified | verified |
| interaction | verified | verified |
| visual themes | verified | verified |

## Use your own

You can replace this component with your own React or Vue component. Map it, and generated code imports yours at the exact version you name. A contract report, run in a real browser, lists what your component met, what it didn't, and what wasn't checked.

The `component_map` call, with the parts in angle brackets yours to fill:

```
{
  "action": "create",
  "apply": true,
  "externalSystem": "<your design system>",
  "externalComponent": "<YourCancellationForm>",
  "oodsTraits": [
    "Cancellable"
  ],
  "substitution": {
    "component": "CancellationForm",
    "react": {
      "package": "<your-package>/react",
      "version": "<exact version>",
      "export": "<YourCancellationForm>"
    },
    "vue": {
      "package": "<your-package>/vue",
      "version": "<exact version>",
      "export": "<YourCancellationForm>"
    }
  }
}
```

## How this page was made

Generated at build from the published data, each source with the hash of what was read. [The page's manifest](https://oods-foundry.com/components/cancellation-form/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.1 componentContracts.CancellationForm` `sha256:f6f1b1b65951…`
- **Documented example**: `@oods/component-contracts@0.10.1 sharedScenarios cancellation-form-presentational-controls` `sha256:87374faa268e…`
- **Catalog entry (catalog_list)**: `generated/0.10.1/system/catalog.json CancellationForm` `sha256:0febf03ad3c0…`
- **React readiness**: `@oods/components-react@0.10.1 readiness CancellationForm` `sha256:91c60ac118ca…`
- **Vue readiness**: `@oods/components-vue@0.10.1 readiness CancellationForm` `sha256:bc60b5406d8c…`
- **Prop types**: `generated/0.10.1/components/prop-types.json CancellationForm` `sha256:18c98cab0ab2…`
