feat: export EdgeLabelRendererProps

This commit is contained in:
Dimitri POSTOLOV
2025-03-25 19:21:06 +01:00
parent c4adfcfa8a
commit 4a45770cc7
2 changed files with 6 additions and 2 deletions

View File

@@ -6,6 +6,10 @@ import type { ReactFlowState } from '../../types';
const selector = (s: ReactFlowState) => s.domNode?.querySelector('.react-flow__edgelabel-renderer');
export type EdgeLabelRendererProps = {
children: ReactNode
}
/**
* Edges are SVG-based. If you want to render more complex labels you can use the
* `<EdgeLabelRenderer />` component to access a div based renderer. This component
@@ -47,7 +51,7 @@ const selector = (s: ReactFlowState) => s.domNode?.querySelector('.react-flow__e
* add mouse interactions you need to set the style `pointerEvents: all` and add
* the `nopan` class on the label or the element you want to interact with.
*/
export function EdgeLabelRenderer({ children }: { children: ReactNode }) {
export function EdgeLabelRenderer({ children }: EdgeLabelRendererProps) {
const edgeLabelRenderer = useStore(selector);
if (!edgeLabelRenderer) {

View File

@@ -9,7 +9,7 @@ export { SmoothStepEdge } from './components/Edges/SmoothStepEdge';
export { BaseEdge } from './components/Edges/BaseEdge';
export { ReactFlowProvider } from './components/ReactFlowProvider';
export { Panel, type PanelProps } from './components/Panel';
export { EdgeLabelRenderer } from './components/EdgeLabelRenderer';
export { EdgeLabelRenderer, type EdgeLabelRendererProps } from './components/EdgeLabelRenderer';
export { ViewportPortal } from './components/ViewportPortal';
export { useReactFlow } from './hooks/useReactFlow';