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

View File

@@ -0,0 +1,5 @@
---
'@xyflow/react': patch
---
fix: improve TSDoc comments for `EdgeLabelOptions` and `EdgeTextProps`

View File

@@ -8,9 +8,9 @@ function EdgeTextComponent({
x,
y,
label,
labelStyle = {},
labelStyle,
labelShowBg = true,
labelBgStyle = {},
labelBgStyle,
labelBgPadding = [2, 4],
labelBgBorderRadius = 2,
children,
@@ -34,7 +34,7 @@ function EdgeTextComponent({
}
}, [label]);
if (typeof label === 'undefined' || !label) {
if (!label) {
return null;
}

View File

@@ -28,6 +28,9 @@ export type EdgeLabelOptions = {
* custom controls.
*/
label?: ReactNode;
/**
* Custom styles to apply to the label.
*/
labelStyle?: CSSProperties;
labelShowBg?: boolean;
labelBgStyle?: CSSProperties;
@@ -108,7 +111,13 @@ export type DefaultEdgeOptions = DefaultEdgeOptionsBase<Edge>;
export type EdgeTextProps = SVGAttributes<SVGElement> &
EdgeLabelOptions & {
/**
* The x position where the label should be rendered.
*/
x: number;
/**
* The y position where the label should be rendered.
*/
y: number;
};