> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Array or object: Inherit from data

> Fills missing keys in the array or object from the supplied data.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Fills in any keys that are missing from the incoming array or object using a set of default values you supply. Anything already present in the input is kept as-is; only the gaps are filled from your defaults. Use this to guarantee that certain fields always exist, for example making sure every product carries a default colour, size, or material even when the source system left them out.

The fill happens at every level, so nested objects are completed as well, not just the top-level keys.

This documentation describes: [Schema](/schemas/mapper/list-inherit-from)

## Fields

<FormField property="array" label="Array" required>
  The default values to fall back on, entered as JSON. Any key listed here that is not already present in the input is added with the value you provide. Where a key exists in both, the input keeps its own value and your default is ignored.
</FormField>

## Sample data

| Field | Value                                                            |
| ----- | ---------------------------------------------------------------- |
| Array | `{ "color": "black", "size": "One size", "material": "cotton" }` |

Input:

```json theme={null}
{ "attributes": { "color": "red", "size": "M" } }
```

Output:

```json theme={null}
{ "attributes": { "color": "red", "size": "M", "material": "cotton" } }
```

The input already had `color` and `size`, so those are kept untouched. Only the missing `material` is filled in from the supplied defaults.

```json Configuration theme={null}
{
  "prototype": "list-inherit-from",
  "parameters": {
    "array": {
      "color": "black",
      "size": "One size",
      "material": "cotton"
    }
  }
}
```
