TooltipDemo() — ui Function Reference
Architecture documentation for the TooltipDemo() function in chart-tooltip.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 947f56d1_ee96_ea02_444b_5f8aac100376["TooltipDemo()"] 7fd5c586_1ba0_4ffc_9ec6_c867a4494532["chart-tooltip.tsx"] 947f56d1_ee96_ea02_444b_5f8aac100376 -->|defined in| 7fd5c586_1ba0_4ffc_9ec6_c867a4494532 style 947f56d1_ee96_ea02_444b_5f8aac100376 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/examples/radix/chart-tooltip.tsx lines 122–214
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 : (
<div className="font-medium">{label}</div>
)
if (!payload?.length) {
return null
}
const nestLabel = payload.length === 1 && indicator !== "dot"
return (
<div
className={cn(
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl transition-all ease-in-out hover:-translate-y-0.5",
className
)}
>
{!nestLabel ? tooltipLabel : null}
<div className="grid gap-1.5">
{payload.map((item, index) => {
const indicatorColor = item.fill
return (
<div
key={index}
className={cn(
"[&>svg]:text-muted-foreground flex w-full items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
indicator === "dot" && "items-center"
)}
>
<>
{!hideIndicator && (
<div
className={cn(
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
{
"h-2.5 w-2.5": indicator === "dot",
"w-1": indicator === "line",
"w-0 border-[1.5px] border-dashed bg-transparent":
indicator === "dashed",
"my-0.5": nestLabel && indicator === "dashed",
}
)}
style={
{
"--color-bg": indicatorColor,
"--color-border": indicatorColor,
} as React.CSSProperties
}
/>
)}
<div
className={cn(
"flex flex-1 justify-between leading-none",
nestLabel ? "items-end" : "items-center"
)}
>
<div className="grid gap-1.5">
{nestLabel ? tooltipLabel : null}
<span className="text-muted-foreground">{item.name}</span>
</div>
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TooltipDemo() do?
TooltipDemo() is a function in the ui codebase, defined in apps/v4/examples/radix/chart-tooltip.tsx.
Where is TooltipDemo() defined?
TooltipDemo() is defined in apps/v4/examples/radix/chart-tooltip.tsx at line 122.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free