Skip to main content
Version: 4.3

ValidateUnembedding

type ValidateUnembedding = (context) => boolean;

Decides whether an embedded element may be detached from its parent. Return true to allow detaching, false to keep it embedded. Pass it to the validateUnembedding prop of <Paper>; the callback receives a structured ValidateUnembeddingParams context.

Parameters

ParameterType
contextValidateUnembeddingParams

Returns

boolean

Example

import { GraphProvider, Paper } from '@joint/react';
import type { ValidateUnembedding } from '@joint/react';

// Keep "locked" elements embedded; everything else can be dragged out.
const validate: ValidateUnembedding = ({ child }) => !child.model.get('locked');

<GraphProvider>
<Paper validateUnembedding={validate} renderElement={() => <rect width={80} height={40} />} />
</GraphProvider>;

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub