chartTooltipLabelNone
A Charts block/component from shadcn/ui — clean-room reimplemented for Domphy (see methodology). Call chartTooltipLabelNone() with no arguments for a working demo, or edit the code below live.
Implementation notes
Full port. Combines showLabel and indicator:'none' on the shared formatter to confirm the two visibility flags compose independently rather than being mutually exclusive, as called out in the family's research note.
Status: ported · Reference: shadcn/ui original
// shadcn/ui "charts/tooltip" (label-none recipe) — clean-room
// reimplementation.
//
// Hides both the date header and the per-row color indicator, leaving the
// most minimal possible tooltip: a bare list of series names and values.
//
// Implemented purely from the block's public functional/visual spec — no
// upstream shadcn/ui source was viewed or copied.
import type { DomphyElement } from "@domphy/core";
import {
ACTIVITY_SERIES_CONFIG,
ACTIVITY_TOOLTIP_DATA,
activityBarOption,
activityTooltipCard,
activityTooltipFormatter,
activityTooltipPlot,
formatWeekdayShort,
type ActivityDayPoint,
type ActivitySeriesEntry,
} from "./chart-tooltip-shared.js";
export interface ChartTooltipLabelNoneProps {
data?: ActivityDayPoint[];
series?: ActivitySeriesEntry[];
showCursor?: boolean;
defaultOpenIndex?: number | null;
title?: string;
description?: string;
}
/**
* shadcn/ui "charts/tooltip" label-none recipe — no header, no indicator,
* combining both minimal-content flags at once. Call with no arguments for a
* working demo.
*/
function chartTooltipLabelNone(props: ChartTooltipLabelNoneProps = {}): DomphyElement<"div"> {
const {
data = ACTIVITY_TOOLTIP_DATA,
series = ACTIVITY_SERIES_CONFIG,
showCursor = false,
defaultOpenIndex = 1,
title = "Bar Chart - Tooltip Label None",
description = "No header label and no row indicator",
} = props;
const categories = data.map((point) => formatWeekdayShort(point.date));
const formatter = activityTooltipFormatter(data, series, {
indicator: "none",
showLabel: false,
});
const option = activityBarOption({ data, categories, series, showCursor, formatter });
return activityTooltipCard({
title,
description,
plot: activityTooltipPlot({ option, categories, defaultOpenIndex }),
});
}
export { chartTooltipLabelNone };