Skip to content

Canvas Controls

Last updated 24 Nov 2026

NbCanvasControls floats a set of controls over a canvas, a map or a diagram: zoom, fit, a view switch, a layer toggle. It places itself in a corner or at an edge of the canvas, and each NbCanvasControlsGroup inside it is one raised island with a border, a corner and a lift. It takes any content, and sizes the buttons in it for you.

Usage ​

The canvas is the positioned ancestor: give it position: relative and put the controls inside it.

vue
<template>
  <div class="canvas" style="position: relative">
    <MyCanvas />
    <NbCanvasControls label="Map controls" position="bottom-right">
      <NbCanvasControlsGroup label="Zoom">
        <NbButton
          variant="ghost"
          icon="magnifying-glass-plus"
          label="Zoom in"
          @click="zoomIn"
        />
        <NbButton
          variant="ghost"
          icon="magnifying-glass-minus"
          label="Zoom out"
          @click="zoomOut"
        />
        <NbButton
          variant="ghost"
          icon="frame-corners"
          label="Fit to view"
          @click="fit"
        />
      </NbCanvasControlsGroup>
    </NbCanvasControls>
  </div>
</template>

Orientation and several groups ​

orientation stacks the groups and the controls in each group. Groups sit 8px apart.

Props ​

NbCanvasControls ​

PropTypeDefaultDescription
labelstring(required)The toolbar's accessible name.
position'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right''bottom-right'Where the set floats inside the canvas.
orientation'horizontal' | 'vertical''vertical'Stack direction of the groups and of the controls in each.
size'sm' | 'md' | 'lg' | 'xl''sm'Height of every button inside without a size of its own (32 to 64px).

NbCanvasControlsGroup ​

PropTypeDefaultDescription
labelstring(none)Names the group (role="group") when the set holds more than one.

Both take their content in the default slot.

Tokens ​

TokenDefaultRole
--nb-canvas-controls-inset12pxDistance from the canvas edge.
--nb-canvas-controls-radiusvar(--nb-radius-lg)Corner of each group.
--nb-canvas-controls-shadow0 4px 16px black at 18%Lift of each group off the canvas.