-
Notifications
You must be signed in to change notification settings - Fork 467
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
[Feature]: Way to compose the Legend labels? #978
Comments
<Legend
className='h-auto flex flex-col'
>
{({ data }) => (
data.map(d => (
<LegendLabel color="green" className="...">{d.icon}{d.title}</LegendLabel>
))}
)}
</Legend> I think this might be a good API <Legend
className='h-auto flex flex-col'
categories={categories}
colors={colors}
renderItem={(item) => <LegendLabel color="green" className="...">{d.icon}{d.title}</LegendLabel>}
/> |
+1 |
Interesting idea, will be taking a look at it for one of our next releases. |
@severinlandolt I would love to work on it once it's decided to be implemented |
@abdelkd Sounds cool, I would definitely go down the suggested the route of using an optional render prop. Happy to have working on a PR :) |
@severinlandolt I've added a |
Thanks, will be taking a look at it for v3.16 :) |
What problem does this feature solve?
It would be great to be able to pass
children
intoLegend
component such that we can create our own labels.At the moment, I use
Legend
like the followingHowever, there are cases where I'd want to greatly customise the Legend labels.
For instance, I'd like to be able to include icons for each of my labels, or to use a Tailwind gradient as the label color.
Example of how this might work from a dev standpoint is:
If this is actually possible then please let me know, as I couldn't find documentation for that.
What does the proposed API look like?
No response
The text was updated successfully, but these errors were encountered: