---
title: "Registry Type"
framework: react
version: "2.1.2"
---

# Registry Type

Most Studio types (e.g. `AgStudioApi` and `AgStudioProperties`) include a `TRegistry` generic.

`TRegistry` allows for the Studio API types to reflect the customisations being provided in the properties.

If you are not providing any customisations, you can omit the generic, and it will fall back to the defaults.

If you are providing relevant customisations, you should extend the registry with your overrides.

## Base Registry versus Default Registry

The `TRegistry` generic in interface types extends `AgBaseRegistry`. The `AgBaseRegistry` properties are very broad so that they allow for any custom registry to be used.

The very top level generics on the Studio component use `AgRegistry`, which provides the correct custom component typing.

For the types to work properly, the registry property types requires mapped unions. This means instead of providing a type `SomeDefinition<'a' | 'b'>`, you would provide `SomeDefinition<'a'> | SomeDefinition<'b'>`.

This can be seen in the default registry `AgDefaultRegistry`.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `widgets` | `readonly AgDefaultWidgetDefinition[]` |  | Types for custom widget definitions. |
| `components` | `Partial<Record<string, never>>` |  | Types for custom components. |
| `formats` | `AgFormats` |  | Built-in formats. |
| `buckets` | `AgBucketDefinition[]` |  | Types for custom bucket definitions. |

## Providing a Custom Registry

```
export interface CustomRegistry extends AgDefaultRegistry {
    widgets: readonly (CustomWidgetDefinition | AgDefaultWidgetDefinition)[];
}
```

The above registry adds a custom widget definition type to the existing widget types. `AgDefaultWidgetDefinition` consists of all of the default widget definition types.
