Skip to content

Toolbar

Toolbar is the toolbar control. It extends Control. It shows a row of buttons or tool items on the map, commonly used as entry points for tools such as drawing and measurement. It supports both horizontal and vertical layouts, and is displayed by default at the top-right corner.

js
import { Toolbar } from "maptalks";

const toolbar = new Toolbar({
  items: [
    { item: "Zoom", click: () => {} }
  ]
}).addTo(map);

Constructor

js
new Toolbar(options)

Parameters:

  • options — Toolbar control options.

options

NameTypeDescriptionDefault
itemsArrayThe tool item list. Each element is { item, click, ... }[]
heightNumberThe toolbar height (px)28
verticalBooleanWhether the layout is verticalfalse
positionStringThe control position"top-right"
reverseMenuBooleanReversed menu layoutfalse