## applyDefaultValuesToElement() function

Adds default values to `existingValue` for the given `key` and its children. If `key` is undefined, default values are added to all elements in `elements`. Default values consist of all fixed and pattern values defined in the relevant elements.

**Signature:**

```typescript
export declare function applyDefaultValuesToElement(existingValue: object, elements: Record<string, InternalSchemaElement>, key?: string): object;
```

## Parameters

| Parameter       | Type   | Description |
|------------------|--------|-------------|
| existingValue    | object | The         |
| elements         | Record<string, [InternalSchemaElement](/content/docs/sdk/core.internalschemaelement) > | The elements to which default values should be added. |
| key              | string | _(Optional)_ (optional) The key of the element(s) for which default values should be added. Elements with nested keys are also included. If undefined, default values for all elements are added. |

**Returns:**

object

`existingValue` with default values added

- [applyDefaultValuesToElement() function](/content/docs/sdk/core.applydefaultvaluestoelement#applydefaultvaluestoelement-function/index.html)  
- [Parameters](/content/docs/sdk/core.applydefaultvaluestoelement#parameters/index.html)
