Skip to content
Docs version
@hungpvq/vue-map@1.1.0@hungpvq/vue-map-core@1.1.0@hungpvq/vue-map-dataset@1.1.0@hungpvq/vue-map-draw@1.1.0@hungpvq/map-draw@1.1.0@hungpvq/react-map@1.1.0@hungpvq/react-map-core@1.1.0@hungpvq/react-map-dataset@1.1.0@hungpvq/react-map-draw@1.1.0

ToolbarControl

Usecase

  • Host control buttons that opt into controlLayout="toolbar".
  • On mobile (≤640px), drive Map buttonInMobile modes toolbar and menu (fan-out + overflow).

Mount one <ToolbarControl /> in the map slot whenever you use buttonInMobile="toolbar" or "menu", or when any control sets controlLayout="toolbar".

Props

PropDescriptionTypeRequiredDefault Value
mapIdstringfalse--
dragIdstringfalse--
btnWidthnumberfalse40
controlOrderCSS flex order for the standalone buttonnumberfalse0
position'top-left', 'top-right', 'bottom-left', 'bottom-right'false'bottom-right'
controlLayout'standalone' (corner), 'toolbar' (always in toolbar), 'button' (always corner; not auto-promoted on mobile)'standalone' | 'toolbar' | 'button'false'standalone'
controlVisiblebooleanfalsetrue

Map also accepts buttonInMobile ('button' | 'toolbar' | 'menu', default 'button'). On viewports ≤640px:

  • 'button' — leave corner buttons unchanged
  • 'toolbar' — move declared control buttons into a single ToolbarControl host (except controlLayout="button"). Mount one ToolbarControl in the map slot
  • 'menu' — hide per-control corner buttons; fan out intact clusters by position into corner stacks with outside-in More. Mount one ToolbarControl.

See ToolbarControl.

and

PropDescriptionTypeRequiredDefault
maxVisibleOverride auto overflow band count (advanced)numberfalseauto

ToolbarControl itself uses controlLayout="button" so it is never hidden by mobile promotion.

Mobile buttonInMobile

Set on <Map> (see props):

ValueBehavior
buttonCorner #btn unchanged (default)
toolbarPromote eligible controls into one horizontal toolbar host
menuHide per-control corner #btn; fan out clusters by position into four corner stacks
  • Keep each control’s cluster intact (row / column); overflow outside-in per corner.
  • Vertical edge budget shares unused half-space with the opposite stack; reserve same-edge controlLayout="button" chrome (e.g. MouseCoordinates).
  • Corner More reuses .map-toolbar-overflow (pinned inward of the button column).

Demo: /#/mobile-menu (button / toolbar / menu); toolbar opt-in: /#/toolbar.

Usage

Vue

vue
<script setup lang="ts">
import {
  Map,
  ToolbarControl,
  ZoomControl,
  HomeControl,
  MouseCoordinatesControl,
} from '@hungpvq/vue-map-core';
import '@hungpvq/vue-map-core/style.css';
</script>

<template>
  <Map button-in-mobile="menu">
    <ToolbarControl />
    <ZoomControl position="bottom-right" />
    <HomeControl position="bottom-right" />
    <MouseCoordinatesControl />
  </Map>
</template>

React

tsx
import {
  Map,
  ToolbarControl,
  ZoomControl,
  HomeControl,
  MouseCoordinatesControl,
} from '@hungpvq/react-map-core';
import '@hungpvq/react-map-core/style.css';

<Map buttonInMobile="menu">
  <ToolbarControl />
  <ZoomControl position="bottom-right" />
  <HomeControl position="bottom-right" />
  <MouseCoordinatesControl />
</Map>