This commit is contained in:
Dimitri POSTOLOV
2025-03-25 19:35:08 +01:00
parent c4adfcfa8a
commit c215455735
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;
};