Open abdelkd opened 1 month ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
tremor-storybook | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Mar 21, 2024 3:01pm |
Hey @severinlandolt do you think exporting a new CustomLegendLabel
interface for using in other components with typescript?
for example:
import { Legend, CustomLegendLabel } from '@tremor/react'
const MyCustomLabel = ({ item, index }: CustomLegendLabel) => {
return <p>{index} - {item}</p>
}
const App = () => {
return <Legend categories={["One", "Two", "Three"]} renderItem={MyCustomLabel} />
}
here the developer won't need to define props or use any
Wondering if having a Circle
is the best naming here? May want to allow the dev to create a square or some other shape to as their legend
@nicostombros The Circle component is just a wrapper around the actual colored dot that you find in legends, maybe Dot
or ColoredDot
.
Hello @severinlandolt , May I get your opinion.
Description This PR adds the ability to customize legend labels through custom prop. The prop is
renderItem
and it takes a function or a component,renderItem
provides anitem
string, aCircle
component andindex
.item
is the label that would be used in a normal legend while theCircle
is the component that would typically render in the legend. theindex
is self-explanatory.Related issue(s)
978
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
How has this been tested?
Screenshots (if appropriate):
The PR fulfils these requirements:
main
branch