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.
Code
The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.
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.
| 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 | |
template | 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
labelonselect
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.backgroundform.borderform.textform.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.
| 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.
- Contract:
@oods/component-contracts@0.10.1 componentContracts.TemplatePickersha256:90008c1a4ce2… - Documented example:
@oods/component-contracts@0.10.1 sharedScenarios template-picker-selectssha256:9f73eea35086… - Catalog entry (catalog_list):
generated/0.10.1/system/catalog.json TemplatePickersha256:65658936d8e2… - React readiness:
@oods/components-react@0.10.1 readiness TemplatePickersha256:0e245e84c80d… - Vue readiness:
@oods/components-vue@0.10.1 readiness TemplatePickersha256:c1752f056bc4… - Prop types:
generated/0.10.1/components/prop-types.json TemplatePickersha256:983b60874fa5…