@joint/react
    Preparing search index...

    Interface PaperProps

    Props for Paper — the React-friendly surface over dia.Paper.Options, plus joint-react extras such as custom cell rendering, a controlled viewport transform, and portal targeting.

    Paper events are exposed directly as props (onBlankContextMenu, onElementPointerClick, onLinkMouseEnter, …). Each handler receives a single params object, e.g. onBlankContextMenu={({ paper, event, x, y }) => …}.

    Handlers are always-latest: the paper subscribes once and each event reads the current handler, so inline arrows (onBlankContextMenu={() => …}) are fine, no useCallback needed and no re-subscription on render. For raw native event names or events without an on* form (render:done, cell:highlight, …), use the useOnPaperEvents hook.

    interface PaperProps {
        anchorNamespace?: any;
        background?: BackgroundOptions;
        cellViewNamespace?: any;
        cellVisibility?: CellVisibility;
        className?: string;
        clickThreshold?: number;
        connectionPointNamespace?: any;
        connectionStrategy?: ConnectionStrategyOptions | ConnectionStrategy;
        connectorNamespace?: any;
        defaultLink?: DefaultLink;
        drawGrid?: boolean | GridOptions | GridOptions[];
        drawGridSize?: number | null;
        embeddingMode?: boolean;
        frontParentOnly?: boolean;
        gridSize?: number;
        highlighterNamespace?: any;
        highlighting?: boolean | Record<string, boolean | HighlighterJSON>;
        id?: string;
        interactive?: CellInteractivity;
        labelsLayer?: string | boolean;
        layerViewNamespace?: any;
        linkAnchorNamespace?: any;
        linkPinning?: boolean;
        linkRouting?: LinkRouting;
        magnetThreshold?: string | number;
        markAvailable?: boolean;
        moveThreshold?: number;
        onBlankContextMenu?: (params: PointerBlankEventParams) => void;
        onBlankMouseEnter?: (params: HoverBlankEventParams) => void;
        onBlankMouseLeave?: (params: HoverBlankEventParams) => void;
        onBlankMouseOut?: (params: HoverBlankEventParams) => void;
        onBlankMouseOver?: (params: HoverBlankEventParams) => void;
        onBlankMouseWheel?: (params: WheelBlankEventParams) => void;
        onBlankPointerClick?: (params: PointerBlankEventParams) => void;
        onBlankPointerDblClick?: (params: PointerBlankEventParams) => void;
        onBlankPointerDown?: (params: PointerBlankEventParams) => void;
        onBlankPointerMove?: (params: PointerBlankEventParams) => void;
        onBlankPointerUp?: (params: PointerBlankEventParams) => void;
        onCellContextMenu?: (params: PointerCellEventParams) => void;
        onCellMouseEnter?: (params: HoverCellEventParams) => void;
        onCellMouseLeave?: (params: HoverCellEventParams) => void;
        onCellMouseOut?: (params: HoverCellEventParams) => void;
        onCellMouseOver?: (params: HoverCellEventParams) => void;
        onCellMouseWheel?: (params: WheelCellEventParams) => void;
        onCellPointerClick?: (params: PointerCellEventParams) => void;
        onCellPointerDblClick?: (params: PointerCellEventParams) => void;
        onCellPointerDown?: (params: PointerCellEventParams) => void;
        onCellPointerMove?: (params: PointerCellEventParams) => void;
        onCellPointerUp?: (params: PointerCellEventParams) => void;
        onElementContextMenu?: (params: PointerElementEventParams) => void;
        onElementMagnetContextMenu?: (params: MagnetEventParams) => void;
        onElementMagnetPointerClick?: (params: MagnetEventParams) => void;
        onElementMagnetPointerDblClick?: (params: MagnetEventParams) => void;
        onElementMouseEnter?: (params: HoverElementEventParams) => void;
        onElementMouseLeave?: (params: HoverElementEventParams) => void;
        onElementMouseOut?: (params: HoverElementEventParams) => void;
        onElementMouseOver?: (params: HoverElementEventParams) => void;
        onElementMouseWheel?: (params: WheelElementEventParams) => void;
        onElementPointerClick?: (params: PointerElementEventParams) => void;
        onElementPointerDblClick?: (params: PointerElementEventParams) => void;
        onElementPointerDown?: (params: PointerElementEventParams) => void;
        onElementPointerMove?: (params: PointerElementEventParams) => void;
        onElementPointerUp?: (params: PointerElementEventParams) => void;
        onLinkConnect?: (params: LinkConnectEventParams) => void;
        onLinkContextMenu?: (params: PointerLinkEventParams) => void;
        onLinkDisconnect?: (params: LinkConnectEventParams) => void;
        onLinkMouseEnter?: (params: HoverLinkEventParams) => void;
        onLinkMouseLeave?: (params: HoverLinkEventParams) => void;
        onLinkMouseOut?: (params: HoverLinkEventParams) => void;
        onLinkMouseOver?: (params: HoverLinkEventParams) => void;
        onLinkMouseWheel?: (params: WheelLinkEventParams) => void;
        onLinkPointerClick?: (params: PointerLinkEventParams) => void;
        onLinkPointerDblClick?: (params: PointerLinkEventParams) => void;
        onLinkPointerDown?: (params: PointerLinkEventParams) => void;
        onLinkPointerMove?: (params: PointerLinkEventParams) => void;
        onLinkPointerUp?: (params: PointerLinkEventParams) => void;
        onLinkSnapConnect?: (params: LinkConnectEventParams) => void;
        onLinkSnapDisconnect?: (params: LinkConnectEventParams) => void;
        onPaperMouseEnter?: (params: PaperHoverEventParams) => void;
        onPaperMouseLeave?: (params: PaperHoverEventParams) => void;
        onPaperPan?: (params: PaperPanEventParams) => void;
        onPaperPinch?: (params: PaperPinchEventParams) => void;
        onResize?: (params: ResizeEventParams) => void;
        onScale?: (params: ScaleEventParams) => void;
        onTransform?: (params: TransformEventParams) => void;
        onTranslate?: (params: TranslateEventParams) => void;
        options?: PaperOptions;
        overflow?: boolean;
        paper?: PaperView;
        portalSelector?: PortalSelector;
        preventContextMenu?: boolean;
        preventDefaultBlankAction?: boolean;
        preventDefaultViewAction?: boolean;
        renderElement?: RenderElement<any>;
        renderLink?: RenderLink<any>;
        routerNamespace?: any;
        snapLabels?: boolean;
        snapLinks?: boolean | SnapLinksOptions;
        snapLinksSelf?: boolean | { distance: number };
        style?: CSSProperties;
        transform?: PaperTransform;
        useHTMLOverlay?: boolean;
        validateConnection?: CanConnectOptions | ValidateConnection;
        validateEmbedding?: ValidateEmbedding;
        validateUnembedding?: ValidateUnembedding;
    }

    Hierarchy

    • PaperSupportedOptions
    • PropsWithChildren
    • PaperEventHandlers
      • PaperProps
    Index

    Properties

    anchorNamespace? background? cellViewNamespace? cellVisibility? className? clickThreshold? connectionPointNamespace? connectionStrategy? connectorNamespace? defaultLink? drawGrid? drawGridSize? embeddingMode? frontParentOnly? gridSize? highlighterNamespace? highlighting? id? interactive? labelsLayer? layerViewNamespace? linkAnchorNamespace? linkPinning? linkRouting? magnetThreshold? markAvailable? moveThreshold? onBlankContextMenu? onBlankMouseEnter? onBlankMouseLeave? onBlankMouseOut? onBlankMouseOver? onBlankMouseWheel? onBlankPointerClick? onBlankPointerDblClick? onBlankPointerDown? onBlankPointerMove? onBlankPointerUp? onCellContextMenu? onCellMouseEnter? onCellMouseLeave? onCellMouseOut? onCellMouseOver? onCellMouseWheel? onCellPointerClick? onCellPointerDblClick? onCellPointerDown? onCellPointerMove? onCellPointerUp? onElementContextMenu? onElementMagnetContextMenu? onElementMagnetPointerClick? onElementMagnetPointerDblClick? onElementMouseEnter? onElementMouseLeave? onElementMouseOut? onElementMouseOver? onElementMouseWheel? onElementPointerClick? onElementPointerDblClick? onElementPointerDown? onElementPointerMove? onElementPointerUp? onLinkConnect? onLinkContextMenu? onLinkDisconnect? onLinkMouseEnter? onLinkMouseLeave? onLinkMouseOut? onLinkMouseOver? onLinkMouseWheel? onLinkPointerClick? onLinkPointerDblClick? onLinkPointerDown? onLinkPointerMove? onLinkPointerUp? onLinkSnapConnect? onLinkSnapDisconnect? onPaperMouseEnter? onPaperMouseLeave? onPaperPan? onPaperPinch? onResize? onScale? onTransform? onTranslate? options? overflow? paper? portalSelector? preventContextMenu? preventDefaultBlankAction? preventDefaultViewAction? renderElement? renderLink? routerNamespace? snapLabels? snapLinks? snapLinksSelf? style? transform? useHTMLOverlay? validateConnection? validateEmbedding? validateUnembedding?

    Properties

    anchorNamespace?: any

    Namespace used to resolve element anchor names.

    JointJS built-in anchors

    background?: BackgroundOptions

    Paper background color, image, or pattern. Pass an object such as { color: 'lightblue', image: '/bg.png', repeat: 'flip-xy' }.

    false
    
    cellViewNamespace?: any

    Namespace of cell-view constructors used to resolve a cell's view by type.

    JointJS built-in cell views
    
    cellVisibility?: CellVisibility

    Predicate deciding whether a cell should be rendered. Receives { model, isMounted, paper, graph }; return false to hide the cell. Native positional form is reachable via the options escape hatch.

    className?: string

    CSS classes applied to the paper host element. Combine with width / height rules to size the paper.

    clickThreshold?: number

    Maximum pointer travel (in px) still treated as a click rather than a drag. Moving farther than this between press and release suppresses the pointerclick event.

    5
    
    connectionPointNamespace?: any

    Namespace used to resolve connection point names.

    JointJS built-in connectionPoints

    Decides how the end JSON is stored when the user drops a link end.

    • Function: receives { end, model, magnet, dropPoint, endType, link, paper, graph } and returns the modified EndJSON.
    • Object: ConnectionStrategyOptions with pin preset and/or customize callback.

    Type Declaration

    connectorNamespace?: any

    Namespace used to resolve connector names referenced by links.

    JointJS built-in connectors

    defaultLink?: DefaultLink

    Defines the link created when the user starts dragging from a port or element.

    Can be a factory function receiving connection context, a static LinkRecord, or a dia.Link instance.

    drawGrid?: boolean | GridOptions | GridOptions[]

    Draws a grid pattern on the paper background. Pass true for the default grid or an object to style it (e.g. { color: 'red', thickness: 2 }).

    true
    
    drawGridSize?: number | null

    Spacing of the rendered grid lines in px. Falls back to gridSize when not set.

    matches gridSize

    embeddingMode?: boolean

    Enables embedding: dropping an element onto another re-parents it (the child then moves with its parent). Pair with the validateEmbedding prop to control which parents are allowed.

    false
    
    frontParentOnly?: boolean

    When embedding, only the frontmost element under the pointer is considered a parent; otherwise candidates are tested front-to-back.

    true
    
    gridSize?: number

    Grid step in px that element positions snap to while dragging.

    10
    
    highlighterNamespace?: any

    Namespace used to resolve highlighter names referenced by highlighting.

    JointJS built-in highlighters plus joint-react's magnet highlighter
    
    highlighting?: boolean | Record<string, boolean | HighlighterJSON>

    Highlighter definitions keyed by highlight type (connecting, embedding, magnet/element availability). Override to restyle these visual cues.

    joint-react's themed highlighters
    
    id?: string

    Unique identifier used by joint-react to track the paper instance.

    interactive?: CellInteractivity

    Which pointer interactions are enabled on cells. Accepts a boolean to toggle everything, an InteractivityOptions object for granular control per interaction kind, or a CellInteractivity callback returning either form per cell. The native (cellView, event) callback is reachable via the options escape hatch.

    { labelMove: false, linkMove: false }
    
    labelsLayer?: string | boolean

    Renders link labels into a dedicated top layer (so they are not occluded by later cells). Pass true, or a layer name to target a specific layer.

    false
    
    layerViewNamespace?: any

    Namespace of layer-view constructors used to resolve custom paper layers.

    JointJS built-in layer views
    
    linkAnchorNamespace?: any

    Namespace used to resolve link anchor names.

    JointJS built-in linkAnchors

    linkPinning?: boolean

    Allows dropping a link end on blank paper, pinning it to a fixed point instead of requiring an element/port.

    false
    
    linkRouting?: LinkRouting

    Bundle of link routing defaults (router, connector, anchor, connection point). Use a preset (linkRoutingStraight, linkRoutingOrthogonal, linkRoutingSmooth) or pass a custom object of the same shape.

    defaultLinkAnchor is reachable via the options escape hatch.

    Values inside options override matching keys here.

    import { linkRoutingOrthogonal } from '@joint/react';

    <Paper linkRouting={linkRoutingOrthogonal()} />
    magnetThreshold?: string | number

    Pointer travel (in px) before a link is created from a magnet, or 'onleave' to create it once the pointer leaves the magnet.

    'onleave'
    
    markAvailable?: boolean

    Highlights valid drop targets (magnets and elements) while a link is being dragged.

    true
    
    moveThreshold?: number

    Pointer travel (in px) required before pointermove events start firing.

    0
    
    onBlankContextMenu?: (params: PointerBlankEventParams) => void
    onBlankMouseEnter?: (params: HoverBlankEventParams) => void
    onBlankMouseLeave?: (params: HoverBlankEventParams) => void
    onBlankMouseOut?: (params: HoverBlankEventParams) => void
    onBlankMouseOver?: (params: HoverBlankEventParams) => void
    onBlankMouseWheel?: (params: WheelBlankEventParams) => void
    onBlankPointerClick?: (params: PointerBlankEventParams) => void
    onBlankPointerDblClick?: (params: PointerBlankEventParams) => void
    onBlankPointerDown?: (params: PointerBlankEventParams) => void
    onBlankPointerMove?: (params: PointerBlankEventParams) => void
    onBlankPointerUp?: (params: PointerBlankEventParams) => void
    onCellContextMenu?: (params: PointerCellEventParams) => void
    onCellMouseEnter?: (params: HoverCellEventParams) => void
    onCellMouseLeave?: (params: HoverCellEventParams) => void
    onCellMouseOut?: (params: HoverCellEventParams) => void
    onCellMouseOver?: (params: HoverCellEventParams) => void
    onCellMouseWheel?: (params: WheelCellEventParams) => void
    onCellPointerClick?: (params: PointerCellEventParams) => void
    onCellPointerDblClick?: (params: PointerCellEventParams) => void
    onCellPointerDown?: (params: PointerCellEventParams) => void
    onCellPointerMove?: (params: PointerCellEventParams) => void
    onCellPointerUp?: (params: PointerCellEventParams) => void
    onElementContextMenu?: (params: PointerElementEventParams) => void
    onElementMagnetContextMenu?: (params: MagnetEventParams) => void
    onElementMagnetPointerClick?: (params: MagnetEventParams) => void
    onElementMagnetPointerDblClick?: (params: MagnetEventParams) => void
    onElementMouseEnter?: (params: HoverElementEventParams) => void
    onElementMouseLeave?: (params: HoverElementEventParams) => void
    onElementMouseOut?: (params: HoverElementEventParams) => void
    onElementMouseOver?: (params: HoverElementEventParams) => void
    onElementMouseWheel?: (params: WheelElementEventParams) => void
    onElementPointerClick?: (params: PointerElementEventParams) => void
    onElementPointerDblClick?: (params: PointerElementEventParams) => void
    onElementPointerDown?: (params: PointerElementEventParams) => void
    onElementPointerMove?: (params: PointerElementEventParams) => void
    onElementPointerUp?: (params: PointerElementEventParams) => void
    onLinkConnect?: (params: LinkConnectEventParams) => void
    onLinkContextMenu?: (params: PointerLinkEventParams) => void
    onLinkDisconnect?: (params: LinkConnectEventParams) => void
    onLinkMouseEnter?: (params: HoverLinkEventParams) => void
    onLinkMouseLeave?: (params: HoverLinkEventParams) => void
    onLinkMouseOut?: (params: HoverLinkEventParams) => void
    onLinkMouseOver?: (params: HoverLinkEventParams) => void
    onLinkMouseWheel?: (params: WheelLinkEventParams) => void
    onLinkPointerClick?: (params: PointerLinkEventParams) => void
    onLinkPointerDblClick?: (params: PointerLinkEventParams) => void
    onLinkPointerDown?: (params: PointerLinkEventParams) => void
    onLinkPointerMove?: (params: PointerLinkEventParams) => void
    onLinkPointerUp?: (params: PointerLinkEventParams) => void
    onLinkSnapConnect?: (params: LinkConnectEventParams) => void
    onLinkSnapDisconnect?: (params: LinkConnectEventParams) => void
    onPaperMouseEnter?: (params: PaperHoverEventParams) => void
    onPaperMouseLeave?: (params: PaperHoverEventParams) => void
    onPaperPan?: (params: PaperPanEventParams) => void
    onPaperPinch?: (params: PaperPinchEventParams) => void
    onResize?: (params: ResizeEventParams) => void
    onScale?: (params: ScaleEventParams) => void
    onTransform?: (params: TransformEventParams) => void
    onTranslate?: (params: TranslateEventParams) => void
    options?: PaperOptions

    Raw dia.Paper.Options passthrough for anything joint-react doesn't expose as a dedicated prop (e.g. allowLink, validateMagnet, restrictTranslate, onViewPostponed).

    Values set here override top-level props of the same name, treat this as the authoritative form for users who need direct access to the raw JointJS API. Avoid overriding joint-react-controlled options (async, sorting, viewManagement, frozen, autoFreeze), the portal rendering depends on their set values.

    overflow?: boolean

    Lets cell content spill outside the paper viewport instead of being clipped.

    false
    
    paper?: PaperView

    Pre-created paper instance to adopt. When provided, the Paper component wraps this paper instead of creating a new one. The paper's DOM is assumed to be managed externally (e.g. by a stencil).

    PaperView is an internally-managed instance, not a public, importable type; you normally receive it from another joint-react construct (such as a stencil) rather than constructing it yourself.

    portalSelector?: PortalSelector

    Paper-level override for the React portal target selector.

    By default, each cell uses its own portalSelector field. ElementModel renders into its '__portal__' group, LinkModel into its root <g>. Built-in JointJS shapes have no portalSelector field and are skipped. Set this prop to force a single selector or a dynamic one across all cells.

    A function receives { model, paper, graph } and may return:

    • a selector string, look up that node,
    • an Element, use that DOM node directly,
    • null, skip rendering for this cell,
    • undefined (or no return), fall back to the cell's own portalSelector.
    // Render into the 'root' selector of all cells
    <Paper portalSelector="root" renderElement={...} />
    // Route built-in shapes to 'root'; let ElementModel cells use their default
    <Paper portalSelector={({ model }) => {
    if (model.get('type') === 'standard.Rectangle') return 'root';
    // implicit: use the cell's own portalSelector
    }} renderElement={...} />
    preventContextMenu?: boolean

    Suppresses the browser context menu over the paper so contextmenu events can drive your own UI.

    true
    
    preventDefaultBlankAction?: boolean

    Prevents the browser default action on blank-area pointer events.

    false
    
    preventDefaultViewAction?: boolean

    Prevents the browser default action on cell pointer events.

    true
    
    renderElement?: RenderElement<any>

    Renders each element from its data slice.

    Note: JointJS works with SVG by default, so renderElement is appended inside an SVG node. To render HTML elements, use the experimental useHTMLOverlay prop or an SVG foreignObject.

    Receives the element's data slice only. Derive its type from your cells with InferElement<typeof cells>['data'].

    type NodeData = InferElement<typeof initialCells>['data']
    // HTML content lives inside <HTMLBox> so it renders correctly in SVG mode.
    function RenderElement(data: NodeData) {
    return <HTMLBox className="node">{data.label}</HTMLBox>
    }
    type NodeData = InferElement<typeof initialCells>['data']
    const renderElement: RenderElement<NodeData> = useCallback(
    (data) => <HTMLBox className="node">{data.label}</HTMLBox>,
    []
    )
    renderLink?: RenderLink<any>

    Renders each link's content from its data slice. Re-runs when the link's data changes.

    Note: JointJS works with SVG by default, so renderLink content is appended inside an SVG node. To render HTML elements, use an SVG foreignObject.

    Receives the link's data slice only. Derive its type from your cells with InferLink<typeof cells>['data']. When you need the source, target, or id, read them with useCell() from inside the renderer.

    • this feature is experimental and may have limitations or issues. Use at your own risk.
    type LinkData = InferLink<typeof initialCells>['data']
    function RenderLink(data: LinkData) {
    return <text>{data.label}</text>;
    }
    type LinkData = InferLink<typeof initialCells>['data']
    const renderLink: RenderLink<LinkData> = useCallback(
    (data) => <text>{data.label}</text>,
    []
    )
    type LinkData = InferLink<typeof initialCells>['data']
    function RenderLink(data: LinkData) {
    // source / target / id live on the context, not the data slice
    const id = useCellId();
    return <text>{data.label} ({id})</text>;
    }
    routerNamespace?: any

    Namespace used to resolve router names referenced by links.

    JointJS built-in routers

    snapLabels?: boolean

    Snaps a dragged link label to the closest point on the link path.

    false
    
    snapLinks?: boolean | SnapLinksOptions

    Snaps a dragged link end to nearby ports/elements. Pass { radius } to set the snapping distance in px.

    { radius: 15 }
    
    snapLinksSelf?: boolean | { distance: number }

    Allows a link end to snap to its own source/target element.

    false
    
    style?: CSSProperties

    Inline styles applied to the paper host element. Use style.width and style.height (or CSS via className) to size the paper, Paper does not expose dedicated width/height props.

    transform?: PaperTransform

    Sets the paper's viewport transform via paper.matrix(...). Accepts either a CSS transform string (e.g. 'scale(0.5)', 'translate(10px, 20px) rotate(15deg)') or a DOMMatrix. Useful for zoom, minimap, and arbitrary viewport transforms.

    <Paper transform="scale(0.4)" />
    <Paper transform={new DOMMatrix().scale(2).translate(10, 20)} />
    useHTMLOverlay?: boolean

    Renders elements as real HTML in an overlay instead of inside an SVG node. By default renderElement output is mounted in SVG, so plain HTML needs a foreignObject (or an HTMLBox); enable this to skip that wrapping. Known issues with HTML element rendering — use at your own risk.

    false
    
    validateConnection?: CanConnectOptions | ValidateConnection

    Validates whether a connection between two elements/ports is allowed.

    • Function: custom validation with built-in rules (no self-loops, no link-to-link, no multi-links). Receives { source, target, endType, paper, graph }.
    • Object: CanConnectOptions with built-in rules and optional validate callback.

    When omitted, defaults to canConnect() (no self-loops, no link-to-link, no multi-links).

    Type Declaration

    • CanConnectOptions

      Options for the validateConnection prop of <Paper> — declarative rules that toggle the common connection constraints (self-loops, link-to-link, duplicate links, root connections) and optionally layer your own check on top. Reach for this object instead of a ValidateConnection callback when the built-in rules already cover what you need.

      • Allow links to start or end on another link, not just on elements.

        false
        
      • Optional ReadonlyallowRootConnection?: boolean | "auto"

        Whether a link may attach to an element's root (its body) instead of a port or magnet.

        • true — always allow root connections.
        • false — never allow them; require a port or magnet.
        • 'auto' — allow a root connection only when the element has no ports.
        'auto'
        
      • Optional ReadonlyallowSelfLoops?: boolean

        Allow a cell to connect to itself.

        false
        
      • Optional ReadonlylinkLimit?: "none" | "one-per-direction" | "one-per-pair"

        How many links may connect the same source+port and target+port. Matching is port/magnet aware, so links on different ports never collide.

        • 'none' — no limit; any number of links, in either direction.
        • 'one-per-direction' — one link each way: a second A→B is blocked, but the reverse B→A is allowed.
        • 'one-per-pair' — one link per element pair: A→B blocks both another A→B and the reverse B→A.
        'one-per-direction'
        
      • Optional Readonlyvalidate?: (context: ValidateConnectionParams) => boolean

        Extra check run only after every built-in rule passes; receives the same ValidateConnectionParams context as ValidateConnection.

    • ValidateConnection
    validateEmbedding?: ValidateEmbedding

    Validates whether an element can be embedded into another element. Receives { child, parent, paper, graph }.

    validateUnembedding?: ValidateUnembedding

    Validates whether an element can be unembedded from its parent. Receives { child, paper, graph }.