---
title: "NavigationControMLGL | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class NavigationControMLGL

A `NavigationControl` control contains zoom buttons and a compass.

#### Example[](#example)

```typescript
let nav = new NavigationControl();
map.addControl(nav, 'top-left');
```

#### See[](#see)

[Display map navigation controls](https://maplibre.org/maplibre-gl-js/docs/examples/display-map-navigation-controls/)

#### Hierarchy ([View Summary](https://docs.maptiler.com/sdk-js/api-reference/hierarchy/#NavigationControMLGL))

-   NavigationControMLGL
    -   [MaptilerNavigationControl](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerNavigationControl/)

#### Implements

-   [IControl](https://docs.maptiler.com/sdk-js/api-reference/interfaces/IControl/)

##### Index

### Constructors

[constructor](#constructor)

### Properties

[options](#options)

### Methods

[onAdd](#onadd) [onRemove](#onremove)

## Constructors

### constructor[](#constructor)

-   new NavigationControMLGL(  
        options?: [NavigationControlOptions](https://docs.maptiler.com/sdk-js/api-reference/types/NavigationControlOptions/),  
    ): NavigationControMLGL[](#constructornavigationcontromlgl)
    
    #### Parameters
    
    -   `Optional`options: [NavigationControlOptions](https://docs.maptiler.com/sdk-js/api-reference/types/NavigationControlOptions/)
        
        the control's options
        
    
    #### Returns NavigationControMLGL
    

## Properties

### options[](#options)

options: [NavigationControlOptions](https://docs.maptiler.com/sdk-js/api-reference/types/NavigationControlOptions/)

## Methods

### onAdd[](#onadd)

-   onAdd(map: [MapMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/MapMLGL/)): [HTMLElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLElement/)[](#onadd-1)
    
    Register a control on the map and give it a chance to register event listeners and resources. This method is called by [Map.addControl](https://docs.maptiler.com/sdk-js/api-reference/classes/Map/#addcontrol) internally.
    
    #### Parameters
    
    -   map: [MapMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/MapMLGL/)
        
        the Map this control will be added to
        
    
    #### Returns [HTMLElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLElement/)
    
    The control's container element. This should be created by the control and returned by onAdd without being attached to the DOM: the map will insert the control's element into the DOM as necessary.
    
    Implementation of [IControl](https://docs.maptiler.com/sdk-js/api-reference/interfaces/IControl/).[onAdd](https://docs.maptiler.com/sdk-js/api-reference/interfaces/IControl/#onadd)
    

### onRemove[](#onremove)

-   onRemove(): void[](#onremove-1)
    
    Unregister a control on the map and give it a chance to detach event listeners and resources. This method is called by [Map.removeControl](https://docs.maptiler.com/sdk-js/api-reference/classes/Map/#removecontrol) internally.
    
    #### Returns void
    
    Implementation of [IControl](https://docs.maptiler.com/sdk-js/api-reference/interfaces/IControl/).[onRemove](https://docs.maptiler.com/sdk-js/api-reference/interfaces/IControl/#onremove)
