logo

X6

  • Tutorials
  • API
  • Examples
  • Q&A
  • Change Log
  • XFlow
  • Productsantv logo arrow
  • 2.x
  • start
    • Introduction
    • Quick Start
  • component
    • XFlowGraph Canvas
    • Background
    • Grid
    • Clipboard Copy and Paste
    • History Undo Redo
    • Minimap
    • Snapline Alignment Lines
    • Transform
    • Control Controller
  • Hook
    • useGraphInstance
    • useGraphStore
    • useGraphEvent
    • useDnd
    • useClipboard
    • useExport
    • useHistory
    • useKeyboard
  • Store

useClipboard

Previous
useDnd
Next
useExport

Resource

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-Interactive solution
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

A Hook for copying and pasting nodes and edges.

Basic Usage

const { copy, paste, cut } = useClipboard();

API

const {
copy: (ids, copyOptions) => void,
paste: (ids, cutOptions) => void,
cut: (pasteOptions) => void
} = useClipboard();

Return Values

ParameterDescriptionType
copyCopy elements(ids: string[], copyOptions?: CopyOptions) => void
pasteRender elements(ids: string[], cutOptions?: CopyOptions) => void
cutRender elements(pasteOptions?: PasteOptions) => Cell[]

CopyOptions parameters are as follows

ParameterDescriptionTypeDefault Value
deepWhether to recursively copy all child nodes/edges.boolean-
useLocalStorageWhether to save the copied nodes/edges in localStorageboolean-

PasteOptions parameters are as follows

ParameterDescriptionTypeDefault Value
offsetOffset for pasting nodes/edges onto the canvasnumber | { dx: number; dy: number }20
useLocalStorageWhether to use nodes/edges from localStorageboolean-
nodePropsAdditional properties for nodes pasted onto the canvasNode.Properties-
edgePropsAdditional properties for edges pasted onto the canvasEdge.Properties-

Parameters

None