Custom Controls

Learn how to add custom control elements to the map.

We'll cover the following

Apart from customizing the existing Google Maps API controls’ style, behavior, and position, users can also create their own control elements.

Create custom controls

Here are a few guidelines that must be followed when creating effective custom controls:

  • Write clean and correct Cascading Style Sheets (CSS) to display the control elements.
  • Think of all the possible interactions between the user and map. Handle the associated user events and changes in map properties through event handlers.
  • Use a div element to define the control. Insert the div element inside the controls property of the map object.

Get hands-on with 1200+ tech skills courses.