'use client' import * as React from 'react' import { cn } from '@/lib/utils' export default function Component() { return (
Label
Name
Indicator
) } function TooltipDemo({ indicator = 'dot', label, payload, hideLabel, hideIndicator, className, }: { label: string hideLabel?: boolean hideIndicator?: boolean indicator?: 'line' | 'dot' | 'dashed' payload: { name: string value: number fill: string }[] nameKey?: string labelKey?: string } & React.ComponentProps<'div'>) { const tooltipLabel = hideLabel ? null :
{label}
if (!payload?.length) { return null } const nestLabel = payload.length === 1 && indicator !== 'dot' return (
{!nestLabel ? tooltipLabel : null}
{payload.map((item, index) => { const indicatorColor = item.fill return (
svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground', indicator === 'dot' && 'items-center' )} > <> {!hideIndicator && (
)}
{nestLabel ? tooltipLabel : null} {item.name}
{item.value.toLocaleString()}
) })}
) }