Skip to content

Documentation regarding component customisation is contradictory.  #2940

Description

@dwjohnston
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

In the repro on lines 125, 127, comment out and note that both examples of axis tick customisation work, although the second has a type error.

What is expected?

Documentation here: https://recharts.org/en-US/guide/customize

Tells us that we can customise via a render prop: ie. a function that accepts props and returns jsx:

tick={renderCustomAxisTick}

However, the docs here:

https://recharts.org/en-US/api/XAxis#tick

Don't tell us that a render prop is valid.

tick: Boolean | Object | ReactElementoptional

The example here:

https://recharts.org/en-US/examples/CustomizedLabelLineChart

Shows an actual React Node being passed in.

          <XAxis dataKey="name" height={60} tick={<CustomizedAxisTick />} />

What is actually happening?

Both a renderProp and a React.Node appear to be valid methods for customising the tick. The documentation should reflect this.

Environment Info
Recharts v2.1.6
React documentation only
System documentation only
Browser documentation only

I'm a curious how the

          <XAxis dataKey="name" height={60} tick={<CustomizedAxisTick />} />

Actually works. You're not passing any props here. I assume you're doing some kind of clone element and passing new props in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docs neededIssues that require documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions