Components / core
PreferenceEditor
Presents controls for a preference record.
Generated from @oods/foundry 0.19.0
- Categories
- core
- 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 preference-editor-namespace-and-document : mount, a Namespace select with billing selected and a Preference Document textarea holding the document text.
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 { PreferenceEditor } from '@oods/components-react';
import '@oods/component-styles/css';
const namespaces = [
"notifications",
"billing"
];
export function Example() {
return (
<PreferenceEditor
title="Preferences"
namespaces={namespaces}
namespace="billing"
document={"{\"email\":true}"}
/>
);
}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 | Preferences |
label | string | undefined | no | |
heading | string | undefined | no | |
name | string | undefined | no | |
description | string | undefined | no | |
subtitle | string | undefined | no | |
hint | string | undefined | no | |
namespaces | readonly unknown[] | undefined | no | ["notifications","billing"] |
namespace | string | undefined | no | billing |
document | string | undefined | no | {"email":true} |
json | string | undefined | no | |
value | string | undefined | no |
Slots
default
Events
none
States
editing
Accessibility
- Role
textbox- How it gets its name
labelontextarea
Keyboard
| Key | What it does |
|---|---|
| Tab | Move focus to the named native control |
| x | Edit the named control |
Obligations in the contract
- A real h3 heading names the form
- Namespace is a labelled select and Preference Document a labelled textarea
Mirrors renderPreferenceEditor over renderFormContainer with data-form-type=preference-editor: title aliases title/label/heading/name (default Preference Editor), subtitle aliases description/subtitle/hint, a Namespace select over namespaces (default: default) selecting namespace, and a Preference Document textarea prefilled from document/json/value; authored children replace the generated body. namespacesField lowers to namespaces; documentField lowers to a JSON-serialized document string so the textarea retains the structured preference value; registryNamespaceParameter is consumed. The controls are unwired and submitting is a no-op.
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 a build of 0.19.0's source before it was published, not on the published package.
| 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": "<YourPreferenceEditor>",
"oodsTraits": [
"Preferenceable"
],
"substitution": {
"component": "PreferenceEditor",
"react": {
"package": "<your-package>/react",
"version": "<exact version>",
"export": "<YourPreferenceEditor>"
},
"vue": {
"package": "<your-package>/vue",
"version": "<exact version>",
"export": "<YourPreferenceEditor>"
}
}
} 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.19.0 componentContracts.PreferenceEditorsha256:25ad105428f0… - Documented example:
@oods/component-contracts@0.19.0 sharedScenarios preference-editor-namespace-and-documentsha256:699f1ce0e769… - Catalog entry (catalog_list):
generated/0.19.0/system/catalog.json PreferenceEditorsha256:aaa97a00201d… - React readiness:
@oods/components-react@0.19.0 readiness PreferenceEditorsha256:62deb595ecbe… - Vue readiness:
@oods/components-vue@0.19.0 readiness PreferenceEditorsha256:14e3fc183755… - Prop types:
generated/0.19.0/components/prop-types.json PreferenceEditorsha256:36b47a1d23d1…