---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/objectManager.Balloon.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# objectManager.Balloon

Extends [IBalloonManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md).

Manager for the collection balloon ObjectManager. Allows to manage the object's balloon by opening it and hiding it. It uses the map balloon manager [map.Balloon](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.Balloon.md). Collections of objects in [ObjectManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ObjectManager.md) contain an instance of this class, accessible as myObjectManager.objects.balloon and myObjectsLayer.clusters.balloon. Don't create new instances of this class unless necessary.

**See** [Balloon](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Balloon.md)

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
objectManager.Balloon(collection)
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`collection`](#param-collection)[*](*star) | — | Type: IReadOnlyCollection

Collection of objects. ||
|#

\* Mandatory parameter/option.

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md) | Event manager.

Inherited from [IEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events). ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [autopanbegin](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-autopanbegin) | Start of automatic shifting of the map center initiated by the autoPan method. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- target - Reference to the [IBalloonOwner](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonOwner.md) object.

Inherited from [IBalloonManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-autopanbegin). ||
|| [autopanend](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-autopanend) | End of automatic shifting of the map center initiated by the autoPan method. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- target - Reference to the [IBalloonOwner](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonOwner.md) object.

Inherited from [IBalloonManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-autopanend). ||
|| [beforeuserclose](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-beforeuserclose) | The event which precedes [Balloon.event:userclose](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Balloon.md#event-userclose). Allows you to cancel the user's action by calling the preventDefault method. Instance of the Event class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- target - Reference to the [IBalloonOwner](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonOwner.md) object.

Inherited from [IBalloonManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-beforeuserclose). ||
|| [close](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#event-close) | Closing the info object. Names of fields available via [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get): 
- target - Reference to the object where the closing occurred.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#event-close). ||
|| [open](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#event-open) | Opening the info object. Names of fields available via [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get): 
- target - Reference to the object where the opening occurred.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#event-open). ||
|| [userclose](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-userclose) | Balloon closed by the user. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- target - Reference to the [IBalloonOwner](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonOwner.md) object.

Inherited from [IBalloonManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#event-userclose). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [autoPan](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#autoPan)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Moves the map so that the balloon is visible.

Inherited from [IBalloonManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBalloonManager.md#autoPan). ||
|| [close](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#close)(\[[force](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#close-param-force)]) | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Closes an open balloon. ||
|| [destroy](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#destroy)() | | Disables the info object manager.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#destroy). ||
|| [getData](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#getData)() | Object\|null | Returns hash describing the object the balloon is open on, or null if the balloon was not opened. ||
|| [getOptions](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getOptions)() | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md)\|null | Returns the options manager or 'null'.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getOptions). ||
|| [getOverlay](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getOverlay)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Returns the promise object to return the overlay.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getOverlay). ||
|| [getOverlaySync](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getOverlaySync)() | [IOverlay](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOverlay.md)\|null | Returns the overlay, if one exists.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getOverlaySync). ||
|| [getPosition](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getPosition)() | Number[]\|null | Returns the coordinates of the info object or 'null'.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#getPosition). ||
|| [isOpen](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#isOpen)([id](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#isOpen-param-id)) | Boolean | A method that detects whether the balloon is open on the object with the passed identifier. ||
|| [open](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#open)([objectId](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#open-param-objectId), [anchorPixelPosition](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#open-param-anchorPixelPosition)) | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Opens the balloon on the object with the passed identifier. ||
|| [setData](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#setData)([objectData](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/objectManager.Balloon.md#setData-param-objectData)) | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Sets new data for displaying the balloon. ||
|| [setOptions](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#setOptions)([options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#setOptions-param-options)) | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Defines new options for the info object.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#setOptions). ||
|| [setPosition](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#setPosition)([position](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#setPosition-param-position)) | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md) | Specifies a new position for the info object.

Inherited from [IPopupManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPopupManager.md#setPosition).||
|#

## Methods details {#method_detail}

### close {#close}

```javascript
{vow.Promise} close([force])
```

Closes an open balloon.

**Returns** Promise object.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`force`](#close-param-force) | false | Type: Boolean

Instant closure. ||
|#


**Example:**

```javascript
// Closing all balloons on the layer.
objectManager.objects.balloon.close();
objectManager.clusters.balloon.close();
```

### getData {#getData}

```javascript
{Object|null} getData()
```

**Returns** hash describing the object the balloon is open on, or null if the balloon was not opened.

**Example:**

```javascript
var cluster = objectManager.clusters.balloon.getData();
if (cluster) {
    alert('The balloon for a cluster of  ' + cluster.properties.geoObjects.length + ' objects is currently opened.');
}
```

### isOpen {#isOpen}

```javascript
{Boolean} isOpen(id)
```

A method that detects whether the balloon is open on the object with the passed identifier.

**Returns** balloon state: open/closed.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`id`](#isOpen-param-id)[*](*star) | — | Type: Object

Object ID. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Closing the ballon after the second click on the placemark.
objectManager.objects.options.set('hideIconOnBalloonOpen', false);
objectManager.objects.events.add('click', function (e) {
    var objectId = e.get('objectId');
    if (objectManager.objects.balloon.isOpen(objectId)) {
        objectManager.objects.balloon.close();
    }
});
```

### open {#open}

```javascript
{vow.Promise} open(objectId, anchorPixelPosition)
```

Opens the balloon on the object with the passed identifier.

**Returns** Promise object.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`objectId`](#open-param-objectId)[*](*star) | — | Type: Object

ID of the object to open the balloon on. ||
|| [`anchorPixelPosition`](#open-param-anchorPixelPosition)[*](*star) | — | Type: ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Loading the object data before opening the balloon.
// Disabling automatic balloon opening by clicking on the object.
objectManager.options.set('geoObjectOpenBalloonOnClick', false);
objectManager.objects.events.add('click', function (e) {
    var objectId = e.get('objectId');
    // Preloading the object data after the object was clicked.
    loadObjectData(objectId).then(function (data) {
        // As soon as the data is ready, we're assigning it to the object and opening the balloon.
        objectManager.objects.getById(objectId).properties = data;
        objectManager.objects.balloon.open(objectId);
    });
});
```

### setData {#setData}

```javascript
{vow.Promise} setData(objectData)
```

Sets new data for displaying the balloon.

**Returns** Promise object.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`objectData`](#setData-param-objectData)[*](*star) | — | Type: Object

Hash with a description of the object to open the balloon on. Corresponds to the object description that is input to ObjectManager.add. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Preloading the object data after the ballon is opened on the object.
objectManager.objects.events.add('balloonopen', function (e) {
    var objectId = e.get('objectId'),
        object = objectManager.objects.getById(objectId);
    if (!object.properties) {
        loadObjectData(objectId).then(function (data) {
            if (objectManager.balloon.isOpen(objectid)) {
                object.properties = data;
                objectManager.objects.balloon.setData(object);
            }
        });
    }
});
```

[*star]: Mandatory parameter/option.