Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Axis /> labelProps is documented as Partial, but overwrites values #1790

Closed
RyKilleen opened this issue Jan 19, 2024 · 1 comment · Fixed by #1791
Closed

<Axis /> labelProps is documented as Partial, but overwrites values #1790

RyKilleen opened this issue Jan 19, 2024 · 1 comment · Fixed by #1791

Comments

@RyKilleen
Copy link
Contributor

Setting a fill color like so:

<Axis
    labelProps={{
      fill: AXIS_TEXT_COLOR,
    }}
/>

overwrites all other label props.

@RyKilleen
Copy link
Contributor Author

RyKilleen commented Jan 19, 2024

The issue can be found here, where labelProps is assigned the default text props and then passed wholesale to getLabelTransform:
https://github.com/airbnb/visx/blob/master/packages/visx-axis/src/axis/AxisRenderer.tsx#L92

It is also spread directly on the Text component her:
https://github.com/airbnb/visx/blob/master/packages/visx-axis/src/axis/AxisRenderer.tsx#L98

Ideally defaults would be handled in the same manner as tickLabelProps in the same file:
https://github.com/airbnb/visx/blob/eddcca449a139d651a417c44bf97d5685da53d0b/packages/visx-axis/src/axis/AxisRenderer.tsx#L46C3-L48C5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant