ui
ui copied to clipboard
[Feat] Extend ChartLegendContent Api for interactivity
fixes #4188
@BalduinB is attempting to deploy a commit to the shadcn-pro Team on Vercel.
A member of the Team first needs to authorize it.
@BalduinB I'll take a look at this. I think we should use the default onClick prop on <ChartLegend /> to do this...
This is also possible, but without creating a context it would look like that:
<ChartLegend
onClick={selectBar}
onMouseOver={handleLegendMouseEnter}
onMouseLeave={handleLegendMouseLeave}
content={({ onClick, onMouseOver, onMouseLeave }) => (
<ChartLegendContent clicked={onClick} mouseOver={onMouseOver} mouseLeave={onMouseLeave} />
)}
/>
not 100% shure, but after a quick search...
Might be worth adding that cursor-pointer is a nice addition to the hover
className={cn(
'flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground',
item.inactive && 'opacity-50',
itemHoverEnter && 'cursor-pointer',
)}
Hi , has this been resolved ?