Skip to Content
Vue Flow v2 is here and joins xyflow! Read more here →

<MiniMap />

Source on GitHub 

The <MiniMap /> component renders an overview of your flow. It renders each node as an SVG element and visualizes where the current viewport is in relation to the rest of the flow.

<script setup lang="ts"> import { shallowRef } from 'vue'; import { MiniMap, VueFlow } from '@xyflow/vue'; const nodes = shallowRef([]); const edges = shallowRef([]); </script> <template> <VueFlow v-model:nodes="nodes" v-model:edges="edges"> <MiniMap :node-stroke-width="3" /> </VueFlow> </template>

Props

The type for props of <MiniMap /> component is exported as MiniMapProps.

NameTypeDefault
nodeColorstring | MiniMapNodeFunc

Color of nodes on minimap.

nodeStrokeColorstring | MiniMapNodeFunc

Stroke color of nodes on minimap.

nodeClassNamestring | MiniMapNodeFunc

Class name applied to nodes on minimap.

nodeBorderRadiusnumber

Border radius of nodes on minimap.

5
nodeStrokeWidthnumber

Stroke width of nodes on minimap.

2
bgColorstring

Background color of minimap.

maskColorstring

The color of the mask that covers the portion of the minimap not currently visible in the viewport.

maskStrokeColorstring

Stroke color of mask representing viewport.

maskStrokeWidthnumber

Stroke width of mask representing viewport.

Scaled by the minimap’s view scale, so the mask border keeps a constant on-screen thickness.

1
positionPanelPosition

Position of minimap on pane, see PanelPosition .

'bottom-right'
pannableboolean

Determines whether you can pan the viewport by dragging inside the minimap.

false
zoomableboolean

Determines whether you can zoom the viewport by scrolling inside the minimap.

false
widthnumber

Width of the mini map, in pixels.

200
heightnumber

Height of the mini map, in pixels.

150
ariaLabelstring | null

Accessible label for the mini map. Pass null to render no label. Defaults to the flow’s configured mini map aria-label.

inversePanboolean

Invert direction when panning the minimap viewport.

zoomStepnumber

Step size for zooming in/out on minimap.

1
offsetScalenumber

Offset the viewport on the minimap, acts like a padding.

5
maskBorderRadiusnumber

Border radius of the viewport mask, in pixels.

0
onClick((params: { event: MouseEvent; position: XYPosition; }) => any) | undefined
onNodeClick((params: NodeMouseEvent<Node<Record<string, unknown>, string | undefined>>) => any) | undefined
onNodeDblclick((params: NodeMouseEvent<Node<Record<string, unknown>, string | undefined>>) => any) | undefined
onNodeMouseenter((params: NodeMouseEvent<Node<Record<string, unknown>, string | undefined>>) => any) | undefined
onNodeMousemove((params: NodeMouseEvent<Node<Record<string, unknown>, string | undefined>>) => any) | undefined
onNodeMouseleave((params: NodeMouseEvent<Node<Record<string, unknown>, string | undefined>>) => any) | undefined

Examples

Making the mini map interactive

By default the mini map is non-interactive. Set either or both of pannable and zoomable to true to let users pan and zoom the viewport from the mini map.

<template> <VueFlow v-model:nodes="nodes" v-model:edges="edges"> <MiniMap pannable zoomable /> </VueFlow> </template>

Customizing mini map node color

nodeColor, nodeStrokeColor, and nodeClassName each accept a function that receives a Node and returns the value for that node — handy for coloring mini map nodes by type.

<script setup lang="ts"> import { MiniMap, VueFlow, type Node } from '@xyflow/vue'; function nodeColor(node: Node) { return node.type === 'input' ? 'blue' : 'red'; } </script> <template> <VueFlow v-model:nodes="nodes" v-model:edges="edges"> <MiniMap :node-color="nodeColor" /> </VueFlow> </template>

Notes

  • <MiniMap /> emits node-click, node-double-click, and the node-mouse-* events, each with the corresponding Node.
  • To render a custom shape per node, use the per-type #node-* slots (e.g. #node-input), typed by MiniMapNodeProps.