<ControlButton />
The <ControlButton /> component adds a button to the
<Controls /> panel, styled to match the
built-in zoom and fit-view buttons.
<script setup lang="ts">
import { shallowRef } from 'vue';
import { ControlButton, Controls, VueFlow } from '@xyflow/vue';
const nodes = shallowRef([]);
const edges = shallowRef([]);
</script>
<template>
<VueFlow v-model:nodes="nodes" v-model:edges="edges">
<Controls>
<ControlButton @click="onCopy">
<CopyIcon />
</ControlButton>
</Controls>
</VueFlow>
</template>Props
| Name | Type | Default |
|---|---|---|
disabled | booleanWhether the button is disabled. | |
label | stringAccessible label for the button, used as both | |
onClick | ((event: MouseEvent) => any) | undefined |
Notes
- The button content is provided through the default slot, so you can drop in any icon or element.
<ControlButton />emitsclickwith the nativeMouseEvent.