diff --git a/packages/visx-axis/src/axis/AxisRenderer.tsx b/packages/visx-axis/src/axis/AxisRenderer.tsx index be9bc0e0e..657260a5f 100644 --- a/packages/visx-axis/src/axis/AxisRenderer.tsx +++ b/packages/visx-axis/src/axis/AxisRenderer.tsx @@ -26,7 +26,7 @@ export default function AxisRenderer({ label = '', labelClassName, labelOffset = 14, - labelProps = defaultTextProps, + labelProps, orientation = Orientation.bottom, scale, stroke = '#222', @@ -42,6 +42,10 @@ export default function AxisRenderer({ ticks, ticksComponent = Ticks, }: AxisRendererProps) { + const combinedLabelProps = { + ...defaultTextProps, + ...labelProps, + }; const tickLabelPropsDefault = { ...defaultTextProps, ...(typeof tickLabelProps === 'object' ? tickLabelProps : null), @@ -89,13 +93,13 @@ export default function AxisRenderer({ className={cx('visx-axis-label', labelClassName)} {...getLabelTransform({ labelOffset, - labelProps, + labelProps: combinedLabelProps, orientation, range: scale.range(), tickLabelFontSize: maxTickLabelFontSize, tickLength, })} - {...labelProps} + {...combinedLabelProps} > {label}