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

# TemplatePicker

Selects a template from supplied choices.

Generated from @oods/foundry 0.10.1

- Categories

  communication

- 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 `template-picker-selects` : mount, Template and Channel selects with welcome and sms selected.

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

The real TemplatePicker, live

React

Notification template

Template Channel

Vue

Notification template

Template Channel

## Code

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

**React**

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

const templates = [
  {
    "id": "welcome",
    "label": "Welcome"
  }
];

const channels = [
  "email",
  "sms"
];

export function Example() {
  return (
    <TemplatePicker
      title="Notification template"
      templates={templates}
      templateId="welcome"
      channels={channels}
      channel="sms"
    />
  );
}
```

## 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 |
| - | - | - | - |
| `title` | `string \| undefined` | no | `Notification template` |
| `label` | `string \| undefined` | no | |
| `heading` | `string \| undefined` | no | |
| `name` | `string \| undefined` | no | |
| `description` | `string \| undefined` | no | |
| `subtitle` | `string \| undefined` | no | |
| `hint` | `string \| undefined` | no | |
| `templates` | `readonly unknown[] \| undefined` | no | `[{"id":"welcome","label":"Welcome"}]` |
| `options` | `readonly unknown[] \| undefined` | no | |
| `templateId` | `string \| undefined` | no | `welcome` |
| `value` | `string \| undefined` | no | |
| `channels` | `readonly unknown[] \| undefined` | no | `["email","sms"]` |
| `channel` | `string \| undefined` | no | `sms` |

### Slots

default

### Events

none

## States

editing

## Accessibility

- Role

  `combobox`

- How it gets its name

  `label` on `select`

### Keyboard

Keyboard

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

### Obligations in the contract

- A fieldset whose legend is the title
- Template and Channel are labelled selects

Mirrors renderTemplatePicker over renderFormContainer with data-form-type=template-picker as a fieldset: the legend reads title/label/heading/name (default Template Picker), subtitle aliases description/subtitle/hint, a Template select over templates, then options (record labels use label, then name; IDs remain values), selecting templateId, then value, and a Channel select over channels (default email/sms/in_app) selecting channel; authored children replace the generated body. templatesField lowers to templates and channelsField to channels. The controls are unwired.

## 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": "<YourTemplatePicker>",
  "oodsTraits": [
    "Communicable"
  ],
  "substitution": {
    "component": "TemplatePicker",
    "react": {
      "package": "<your-package>/react",
      "version": "<exact version>",
      "export": "<YourTemplatePicker>"
    },
    "vue": {
      "package": "<your-package>/vue",
      "version": "<exact version>",
      "export": "<YourTemplatePicker>"
    }
  }
}
```

## 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/template-picker/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.1 componentContracts.TemplatePicker` `sha256:90008c1a4ce2…`
- **Documented example**: `@oods/component-contracts@0.10.1 sharedScenarios template-picker-selects` `sha256:9f73eea35086…`
- **Catalog entry (catalog_list)**: `generated/0.10.1/system/catalog.json TemplatePicker` `sha256:65658936d8e2…`
- **React readiness**: `@oods/components-react@0.10.1 readiness TemplatePicker` `sha256:0e245e84c80d…`
- **Vue readiness**: `@oods/components-vue@0.10.1 readiness TemplatePicker` `sha256:c1752f056bc4…`
- **Prop types**: `generated/0.10.1/components/prop-types.json TemplatePicker` `sha256:983b60874fa5…`
