# Tooltip Control

Tooltip control shows the value (and the direction for vector datasets) at current mouse position on hovering the raster layer

### Example

![Tooltip Control](https://2604220514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhKjNRPJGaBxmTJIsheik%2Fuploads%2Fgit-blob-f5eef656ca0fa007e79479204bef1e49c74e4128%2Ftooltip-control.png?alt=media)

```javascript
import * as WeatherLayers from 'weatherlayers-gl';

const tooltipControl = new WeatherLayers.TooltipControl({
  unitFormat: {
    unit: 'm/s',
  },
  directionFormat: WeatherLayers.DirectionFormat.CARDINAL3,
  followCursor: true,
});
tooltipControl.addTo(deckgl.getCanvas().parentElement);
deckgl.setProps({ onHover: event => tooltipControl.updatePickingInfo(event) });
```

### Constructor

#### `TooltipControl(config: TooltipConfig = {})`

### Config Properties

#### `unitFormat`

Type: [`UnitFormat`](https://docs.weatherlayers.com/types#unitformat), required

Unit definition to be used for formatting.

#### `directionType`

Type: [`DirectionType`](https://docs.weatherlayers.com/types#directiontype), optional

Default value: `INWARD`

Direction type to be used for formatting.

#### `directionFormat`

Type: [`DirectionFormat`](https://docs.weatherlayers.com/types#directionformat), optional

Default value: `VALUE`

Direction format to be used for formatting.

#### `followCursor`

Type: boolean, optional

Default value: false

Follow the mouse cursor position.

#### `followCursorOffset`

Type: number, optional

Default value: `16`

Offset from the mouse cursor position.

#### `followCursorPlacement`

Type: [`Placement`](https://docs.weatherlayers.com/types#placement), optional

Default value: `BOTTOM`

Placement from the mouse cursor position.

### Methods

See [Control](https://docs.weatherlayers.com/weatherlayers-gl/controls/control) for common Control methods.

#### `update(rasterPointProperties:` [`RasterPointProperties`](https://docs.weatherlayers.com/types#rasterpointproperties) `| undefined): void`

Updates the tooltip displayed with the given `rasterPointProperties` or hides the tooltip.

#### `updatePickingInfo(pickingInfo: PickingInfo & { raster?:` [`RasterPointProperties`](https://docs.weatherlayers.com/types#rasterpointproperties) `}): void`

Updates the tooltip displayed with the given `pickingInfo` or hides the tooltip.
