# Customize map display through features and modes
{`
The 3.1 version is deprecated
`}
Note
The 3.1 version of this API has been deprecated. For continued support and feature development, upgrade to the latest [3.2 version](https://docs.here.com/maps-api-for-js/docs/migrate-to-harp).
Note
This functionality is available for the [HARP engine](/maps-api-for-js/docs/migrate-to-harp) only.
In the HERE Maps API for JavaScript, features and modes provide a convenient way to dynamically customize and control the map's display and behavior by allowing specific map objects or elements defined in the style configuration to be displayed or hidden.
* **Feature**: Refers to a specific map object or element that can be displayed or hidden, for example:
* `building extruded`: 3D representations of buildings with height information.
* `public transit`: Routes and stops for buses, trains, and so on.
* `environmental zones`: Areas with traffic restrictions to control emissions and reduce pollution.
* `road exit labels`: Labels indicating exits on roads, typically highways.
* **Mode**: Defines how a feature is displayed. Modes can specify different levels of detail or interaction for a feature. Some mode values are exclusive to certain features. Examples of modes include:
* `all`: Display the feature in full detail.
* `none`: Hide the feature completely.
* `numbers only`: Display road exit labels as numbers (available for the `road exit labels` feature).
## Obtain the list of features and modes
You can retrieve the list of supported features and their modes through the `features` property of the map style, as shown in the following code snippet:
```javascript
// Retrieve the map style:
style = map.getBaseLayer().getProvider().getStyle();
// Get the configuration object of the style and
// access the list of supported features:
configFeatures = style.getConfig().features;
```
The following figure shows the output of the code from the previous example in the context of a web browser window, displaying the list of features and their associated modes, together with the default modes:

The previous example highlights the `environmental zones` feature. This feature's default mode is `none`, which hides environmental zones from the map. As indicated by the `modes` object, this feature has one additional `all` mode available, which enables the display of environmental zones on the map.
## Toggle feature modes at runtime
To change a feature mode to dynamically change the appearance of the map, for example, to enable the display of environmental zones, use the `setEnabledFeatures` method of the `style` object, as shown in the following example:
```javascript
style.setEnabledFeatures([
{ feature: '', mode: '' },
{ feature: '', mode: '' }
])
```
The `setEnabledFeatures` method accepts an array of objects, with each object consisting of `feature` and `mode` key-value pairs.
You can set multiple feature objects simultaneously.
Please note that map configuration should be loaded at the moment you call this method.
For example, the following code snippet sets the highway exit labels to numbers only and enables the display of public transport lanes, after configuration is loaded:
```javascript
const style = map.getBaseLayer().getProvider().getStyle();
const onChangeHandler = (event) => {
if (event.target.getState() === H.map.render.Style.State.READY) {
style.removeEventListener('change', onChangeHandler); // Otherwise loops infinitely.
map.getBaseLayer().getProvider().getStyle().setEnabledFeatures([
{ feature: 'road exit labels', mode: 'numbers only' },
{ feature: 'public transit', mode: 'all systems' }
]);
}
}
style.addEventListener('change', onChangeHandler)
```
For more information, see the [API reference section for the `setEnabledFeatures` method](/maps-api-for-js/v3.1/page/maps-api-for-javascript-api-reference-3-1-h-map-render-harp-style#setEnabledFeatures).
## Example: Utilize features and modes for dynamic map customization
Enabling users to adjust the look and feel of the map dynamically enhances interactivity and usability, making your mapping application more intuitive and user-friendly.
The following example demonstrates how to implement a button to hide or show the environmental zones feature on the map.
### Prerequisites
Configure a basic map to serve as the base for further customization by using features and modes. For more information, see [Sample map rendered with the HARP engine](/maps-api-for-js/docs/migration-guide#sample-map-rendered-with-the-harp-engine).
### Enable toggling the environmental zone display
Expand the basic map functionality by adding a button to switch the `environmental zones` feature modes dynamically.
1. Within the `` tag of the HTML file, add the following `