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

# AddressEditor

Edits street, city, region and postal code through labelled inputs.

Generated from @oods/foundry 0.10.1

- 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 `address-editor-fields-and-change` : type into the City input, change emitted with the current street/city/region/postalCode record.

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

The real AddressEditor, live

React

Vue

Events it emits: change. Use either render above, and each event shows here with the framework that sent it.



## Code

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

**React**

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

export function Example() {
  return (
    <AddressEditor
      title="Shipping address"
      street="1 Main St"
      city="Springfield"
      region="IL"
      postalCode="62701"
    />
  );
}
```

## 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 | `Shipping address` |
| `label` | `string \| undefined` | no | |
| `heading` | `string \| undefined` | no | |
| `name` | `string \| undefined` | no | |
| `description` | `string \| undefined` | no | |
| `subtitle` | `string \| undefined` | no | |
| `hint` | `string \| undefined` | no | |
| `street` | `string \| undefined` | no | `1 Main St` |
| `line1` | `string \| undefined` | no | |
| `addressLine1` | `string \| undefined` | no | |
| `city` | `string \| undefined` | no | `Springfield` |
| `region` | `string \| undefined` | no | `IL` |
| `state` | `string \| undefined` | no | |
| `postalCode` | `string \| undefined` | no | `62701` |
| `zip` | `string \| undefined` | no | |

### Slots

default

### Events

change

## States

editing

## Accessibility

- Role

  `textbox`

- How it gets its name

  `label` on `input[name="city"]`

### Keyboard

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
- Street, City, Region and Postal Code are labelled text inputs

Mirrors renderAddressEditor over renderFormContainer with data-form-type=address-editor: title aliases title/label/heading/name (default Address Editor), subtitle aliases description/subtitle/hint, and four labelled inputs named street/city/region/postalCode prefilled from street/line1/addressLine1, city, region/state and postalCode/zip; authored children replace the generated body. Editing any input emits change with the current street/city/region/postalCode record; the consumer owns that record, so the saved onChange binding is a domain action. The generic field (the addresses collection) and defaultRoleField are consumed unbound; roleParameter and allowDynamicParameter are consumed. Submitting the form is a no-op.

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

## 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/address-editor/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.1 componentContracts.AddressEditor` `sha256:b1f3f2502beb…`
- **Documented example**: `@oods/component-contracts@0.10.1 sharedScenarios address-editor-fields-and-change` `sha256:a994be75288c…`
- **Catalog entry (catalog_list)**: `generated/0.10.1/system/catalog.json AddressEditor` `sha256:64b7444485b2…`
- **React readiness**: `@oods/components-react@0.10.1 readiness AddressEditor` `sha256:8f842a0371df…`
- **Vue readiness**: `@oods/components-vue@0.10.1 readiness AddressEditor` `sha256:3931427686ae…`
- **Prop types**: `generated/0.10.1/components/prop-types.json AddressEditor` `sha256:70c993cf93cb…`
