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

# control.Manager

Manager for map controls.

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

## Constructor {#constructor-summary}

```javascript
control.Manager(map[, controls[, options]])
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`map`](#param-map)[*](*star) | — | Type: [Map](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)

Instance of the map. ||
|| [`controls`](#param-controls) | — | Type: String[]\|[IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md)[]

The controls which should be initially placed on the map. ||
|| [`options`](#param-options) | — | Type: Object

Manager options. ||
|| [`options.margin`](#param-options.margin) | 10 | Type: Number

Distance between adjacent controls and the indent from the edges of the map. Specified in pixels. ||
|| [`options.pane`](#param-options.pane) | — | Type: [IPane](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPane.md)

Container for controls. ||
|| [`options.states`](#param-options.states) | ['small', 'medium', 'large'] | Type: String[]

The array of sizes, from smallest to largest. ||
|#

\* Mandatory parameter/option.

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#events) | [event.Manager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/event.Manager.md)| Event manager. ||
|| [options](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#options) | [option.Manager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md)| Manager options. ||
|| [state](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#state) | [data.Manager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/data.Manager.md)| Manager state. Names of fields that are available via the data.Manager.get method: 
- size - The state of the controls. ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [add](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#add)([control](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#add-param-control)[, [options](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#add-param-options)]) | [control.Manager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md)
| Adds a control to the manager. ||
|| [each](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#each)([callback](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#each-param-callback), [context](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#each-param-context)) | [control.Manager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md)
| Calls a handler function for all the controls. ||
|| [get](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#get)([index](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#get-param-index)) | [IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md)\|null
| Returns the control, or null if no item has been found. ||
|| [getChildElement](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#getChildElement)([control](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#getChildElement-param-control)) | [vow.Promise](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Returns the Promise object, which is confirmed by the HTML element that should hold the child element. ||
|| [getContainer](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#getContainer)() | HTMLElement
| Returns container where elements of the control will be added. ||
|| [getMap](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#getMap)() | [Map](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)
| Returns reference to the map. ||
|| [indexOf](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#indexOf)([childToFind](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#indexOf-param-childToFind)) | Integer
| Returns -1 if the control has not been found, or the index of the item in the manager. ||
|| [remove](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#remove)([control](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md#remove-param-control)) | [control.Manager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.Manager.md)
| Removing a control from the manager. ||
|#

## Fields details {#field_detail}

### events {#events}

```javascript
{event.Manager} events
```

Event manager.

### options {#options}

```javascript
{option.Manager} options
```

Manager options.

### state {#state}

```javascript
{data.Manager} state
```

Manager state. Names of fields that are available via the data.Manager.get method: 
- size - The state of the controls.

## Methods details {#method_detail}

### add {#add}

```javascript
{control.Manager} add(control[, options])
```

Adds a control to the manager.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`control`](#add-param-control)[*](*star) | — | Type: [IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md)\|String

Controls that are set by instances of classes that implement the [IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md) interface, or by keys.

Acceptable key values:

- "fullscreenControl" - Button for opening the map in full-screen mode, [control.FullscreenControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.FullscreenControl.md).
- "geolocationControl" - Button for defining the user location, [control.GeolocationControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.GeolocationControl.md).
- "routeEditor" - Button for enabling or disabling the behavior "route editor" [control.RouteEditor](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.RouteEditor.md).
- "rulerControl" - Button for enabling or disabling the behavior "ruler" [control.RulerControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.RulerControl.md).
- "searchControl" - Search box for processing the user's search query [control.SearchControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.SearchControl.md).
- "trafficControl" - Traffic panel [control.TrafficControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.TrafficControl.md).
- "typeSelector" - Panel for selecting the map type [control.TypeSelector](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.TypeSelector.md).
- "zoomControl" - Zoom slider [control.ZoomControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.ZoomControl.md).
- "routeButtonControl" - Button with the route panel popup [control.RouteButton](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.RouteButton.md).
- "routePanelControl" - The Route Panel control [control.RoutePanel](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/control.RoutePanel.md).

Also, you can specify one of the predefined sets of controls using special keys:

- "smallMapDefaultSet" - Basic set of controls, optimized for small maps and mobile phone screens. It includes the following controls: "zoomControl", "searchControl", "typeSelector", "geolocationControl" and "fullscreenControl". All controls in this set are minimized to buttons with icons.
- "mediumMapDefaultSet" - Basic set of controls, optimized for medium-sized maps and tablet screens. In addition to the basic set of controls (see above), this set includes "rulerControl" and "trafficControl".
- "largeMapDefaultSet" - Basic set of controls, optimized for large maps and desktops. The "routeEditor" control is added to the set and the "fullScreen" control is removed from the set, compared to the "mediumMapDefaultSet".
- "default" - Default set of controls, an alias for "mediumMapDefaultSet". ||
|| [`options`](#add-param-options) | — | Type: Object

Control options. ||
|| [`options.float`](#add-param-options.float) | "right" | Type: String

The side to which you want to align the control. Can take three values: "left", "right" or "none". If set to "left" or "right", the controls are arranged one by one, starting from the left or right edge of the map, respectively. If set to "none", the controls are positioned according to the values of the left, right, bottom and top options, relative to the boundaries of the map. ||
|| [`options.floatIndex`](#add-param-options.floatIndex) | 0 | Type: Number

The priority of the control positioning. The element with highest priority is positioned closer to the map boundary that is specified in the float property. Does not work with float = "none". ||
|| [`options.position`](#add-param-options.position) | — | Type: Object

Object describing the position of a control. If the position option is set, the float option value is automatically treated as "none". ||
|| [`options.position.bottom`](#add-param-options.position.bottom) | 'auto' | Type: Number\|String

Position relative to the bottom edge of the map. Only works with float = none. ||
|| [`options.position.left`](#add-param-options.position.left) | 'auto' | Type: Number\|String

Position relative to the left edge of the map. Only works with float = none. ||
|| [`options.position.right`](#add-param-options.position.right) | 'auto' | Type: Number\|String

Position relative to the right edge of the map. Only works with float = none. ||
|| [`options.position.top`](#add-param-options.position.top) | 'auto' | Type: Number\|String

Position relative to the top edge of the map. Only works with float = none. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
map.controls
    .add('zoomControl')
    .add('typeSelector');
```

### each {#each}

```javascript
{control.Manager} each(callback, context)
```

Calls a handler function for all the controls.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`callback`](#each-param-callback)[*](*star) | — | Type: Function

Handler function. Receives a collection item as input. If the function returns the value "false," processing stops. ||
|| [`context`](#each-param-context)[*](*star) | — | Type: Object

Context of the invoked function. ||
|#

\* Mandatory parameter/option.

### get {#get}

```javascript
{IControl|null} get(index)
```

**Returns** the control, or null if no item has been found.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`index`](#get-param-index)[*](*star) | — | Type: Number\|String

The index of the desired element or key. ||
|#

\* Mandatory parameter/option.

# getChildElement {#getChildElement}

```javascript
{vow.Promise} getChildElement(control)
```

**Returns** the Promise object, which is confirmed by the HTML element that should hold the child element.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`control`](#getChildElement-param-control)[*](*star) | — | Type: [IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md)

Control. ||
|#

\* Mandatory parameter/option.

### getContainer {#getContainer}

```javascript
{HTMLElement} getContainer()
```

**Returns** container where elements of the control will be added.

### getMap {#getMap}

```javascript
{Map} getMap()
```

**Returns** reference to the map.

### indexOf {#indexOf}

```javascript
{Integer} indexOf(childToFind)
```

**Returns** -1 if the control has not been found, or the index of the item in the manager.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`childToFind`](#indexOf-param-childToFind)[*](*star) | — | Type: String|[IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md)

Control or its key. ||
|#

\* Mandatory parameter/option.

### remove {#remove}

```javascript
{control.Manager} remove(control)
```

Removing a control from the manager.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`control`](#remove-param-control)[*](*star) | — | Type: [IControl](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IControl.md)\|String

The deleted control or its key. ||
|#

\* Mandatory parameter/option.

[*star]: Mandatory parameter/option.