ui icon indicating copy to clipboard operation
ui copied to clipboard

[Feat] Extend ChartLegendContent Api for interactivity

Open BalduinB opened this issue 1 year ago • 1 comments

fixes #4188

BalduinB avatar Jul 06 '24 16:07 BalduinB

@BalduinB is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jul 06 '24 16:07 vercel[bot]

@BalduinB I'll take a look at this. I think we should use the default onClick prop on <ChartLegend /> to do this...

shadcn avatar Jul 10 '24 12:07 shadcn

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...

BalduinB avatar Jul 11 '24 11:07 BalduinB

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',
	)}

ScottEAdams avatar Jul 25 '24 19:07 ScottEAdams

Hi , has this been resolved ?

roytrader3 avatar Jul 07 '25 15:07 roytrader3