---
title: "Studio Overview"
framework: javascript
version: "2.1.2"
---

# Studio Overview

This section provides key information for configuring and interacting with Studio.

## Studio Properties

The `studioProperties` object is used to configure Studio. The example below shows the different types of items available on `studioProperties`.

```js
const studioProperties = {
    // PROPERTIES
    data: myData,
    enableRtl: true,

    // EVENTS
    stateUpdated: event => console.log('State updated'),

    // CALLBACKS
    getLocaleText: (params) => {
        // ...
    }
}

// Pass studioProperties to createStudio
const api = createStudio(studioDiv, studioProperties)
```

### Updating Studio Properties

It is a common requirement to update a Studio property after Studio has been created. For example, you may want to change `mode` via an application toggle.

Properties can be updated by calling either `api.setProperty` or `api.updateProperties`. In this example the mode will switch to view.

```js
// update the mode
api.setProperty('mode', 'view');
```

### Initial Studio Properties

A small number of Studio properties do **not** support updating their value. Their value is only read during the initial setup of Studio. These options are marked as `Initial` on the [Properties Reference](https://www.ag-grid.com/studio/javascript/studio-properties/). For these properties Studio must be destroyed and re-created for the new value to take effect.

> **Note**
>
> Not all Studio Properties support updates. These are marked as Initial.

For a full list of properties, see [Properties Reference](https://www.ag-grid.com/studio/javascript/studio-properties/).

## Studio Events

As a user interacts with Studio, events will be fired to enable your application to respond to specific actions.

Register callbacks for events through the `AgStudioProperties` interface. The name of the callback is constructed by prefixing the event name with `on`. For example, the callback for the `stateUpdated` event is `studioProperties.onStateUpdated`.

```js
const studioProperties = {
    // Add event handlers
    onStateUpdated: (event: AgStudioStateUpdatedEvent) => console.log('State was updated'),
}
```

> **Note**
>
> TypeScript users can take advantage of the events' interfaces. Construct the interface name by prefixing the event name with `AgStudio` and suffixing with `Event`. For example, the `stateUpdated` event uses the interface `AgStudioStateUpdatedEvent`.

For a full list of events, see [Studio Events](https://www.ag-grid.com/studio/javascript/studio-events/).

## Studio API

You can access the Studio API by storing a reference to the `api` as returned from `createStudio`.

```js
// create Studio
const api = createStudio(div, studioProperties);

// Call an api method
const state = api.getState();
```

### API within Events and Callbacks

The `api` is also provided on the params for all Studio events and callbacks.

```js
const studioProperties: AgStudioProperties = {
    onApiReady: (event: AgStudioApiReadyEvent) {
        // use API from event
        event.api.getState();
    }
}
```

For a full list of API methods, see [Studio API](https://www.ag-grid.com/studio/javascript/studio-api/).

## Studio State

As a user interacts with Studio they may change state such as widget layout, formatting, filtering, etc. This state is independent of the configuration, and to provide save and restore capabilities Studio enables applications to save / restore this state.

For a full list of the state properties, see [Studio State](https://www.ag-grid.com/studio/javascript/state/).

## Studio Lifecycle

An application may need to perform actions when Studio is first initialised, or about to be destroyed.

For full details about how to interact with Studio at these key moments see: [Studio Lifecycle](https://www.ag-grid.com/studio/javascript/studio-lifecycle/).

## Studio Errors

When errors occur in state or data validation, an error event will be emitted.

```js
const studioProperties = {
    onErrorRaised: (params) => {
        // handle error (e.g. prompt user to load a different report)
    },

    // other studio properties ...
}
```

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `errorRaised` | `AgStudioErrorRaisedEvent` |  | An error has occurred within Studio. |
