Merge pull request #5115 from dimaMachina/tsdoc-edgetext

fix: improve TSDoc comments for `EdgeLabelOptions` and `EdgeTextProps`
This commit is contained in:
Moritz Klack
2025-03-26 09:04:58 +01:00
committed by GitHub
3 changed files with 17 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@xyflow/react': patch
---
fix: improve TSDoc comments for `EdgeLabelOptions` and `EdgeTextProps`
@@ -8,9 +8,9 @@ function EdgeTextComponent({
x, x,
y, y,
label, label,
labelStyle = {}, labelStyle,
labelShowBg = true, labelShowBg = true,
labelBgStyle = {}, labelBgStyle,
labelBgPadding = [2, 4], labelBgPadding = [2, 4],
labelBgBorderRadius = 2, labelBgBorderRadius = 2,
children, children,
@@ -34,7 +34,7 @@ function EdgeTextComponent({
} }
}, [label]); }, [label]);
if (typeof label === 'undefined' || !label) { if (!label) {
return null; return null;
} }
+9
View File
@@ -28,6 +28,9 @@ export type EdgeLabelOptions = {
* custom controls. * custom controls.
*/ */
label?: ReactNode; label?: ReactNode;
/**
* Custom styles to apply to the label.
*/
labelStyle?: CSSProperties; labelStyle?: CSSProperties;
labelShowBg?: boolean; labelShowBg?: boolean;
labelBgStyle?: CSSProperties; labelBgStyle?: CSSProperties;
@@ -108,7 +111,13 @@ export type DefaultEdgeOptions = DefaultEdgeOptionsBase<Edge>;
export type EdgeTextProps = SVGAttributes<SVGElement> & export type EdgeTextProps = SVGAttributes<SVGElement> &
EdgeLabelOptions & { EdgeLabelOptions & {
/**
* The x position where the label should be rendered.
*/
x: number; x: number;
/**
* The y position where the label should be rendered.
*/
y: number; y: number;
}; };