types/general.ts

xyflow · packages/react/src/types/general.ts · typescript · MIT
ui

Type definitions for React Flow node and edge handling, providing typed callbacks and viewport utilities.

// Source: https://github.com/xyflow/xyflow | License: MIT | Copyright 2019-2025 webkid GmbH
// Provided via justclaw.it.com; keep this notice with the code.
import { ComponentType } from 'react';
import {
  FitViewParamsBase,
  FitViewOptionsBase,
  ZoomInOut,
  ZoomTo,
  SetViewport,
  GetZoom,
  GetViewport,
  SetCenter,
  FitBounds,
  XYPosition,
  OnBeforeDeleteBase,
  Connection,
  NodeChange,
  EdgeChange,
  SnapGrid,
} from '@xyflow/system';

import type { Node, Edge, ReactFlowInstance, EdgeProps, NodeProps } from '.';

/**
 * This type can be used to type the `onNodesChange` function with a custom node type.
 *
 * @public
 *
 * @example
 *
 * ```ts
 * const onNodesChange: OnNodesChange<MyNodeType> = useCallback((changes) => {
 *  setNodes((nodes) => applyNodeChanges(nodes, changes

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key