Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

1.1 KB
Raw Blame
import { Tooltip } from '@signozhq/ui/tooltip';
import TooltipScrollArea from 'components/TooltipScrollArea/TooltipScrollArea';

import styles from './OverflowValuesTooltip.module.scss';

interface OverflowValuesTooltipProps {
	/** The selected values the pill hides behind this `+N`. */
	values: string[];
}

/**
 * The multi-select's `+N` overflow item, revealing on hover the values it stands
 * for — one bullet each, all of them, scrolling rather than truncating. The
 * scrollbar stays put instead of auto-hiding, so a capped list reads as scrollable.
 */
function OverflowValuesTooltip({
	values,
}: OverflowValuesTooltipProps): JSX.Element {
	return (
		<Tooltip
			side="top"
			title={
				<TooltipScrollArea>
					<ul className={styles.overflowValues}>
						{values.map((value) => (
							<li key={value}>{value}</li>
						))}
					</ul>
				</TooltipScrollArea>
			}
		>
			{/* rc-select copies this node into the overflow wrapper's `title`; an empty
			    one keeps the browser's own "[object Object]" tooltip out of the way. */}
			<span title="">+{values.length}</span>
		</Tooltip>
	);
}

export default OverflowValuesTooltip;