:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { IconInfo, IconTrending } from '@posthog/icons'
import { LemonCard, LemonTag, Tooltip } from '@posthog/lemon-ui'
import { IconTrendingDown, IconTrendingFlat } from 'lib/lemon-ui/icons'
import type { KpiCardContent, KpiDelta } from './promptReport'
const DeltaTag = ({ delta }: { delta: KpiDelta }): JSX.Element => {
const Icon =
delta.direction === 'flat' ? IconTrendingFlat : delta.direction === 'up' ? IconTrending : IconTrendingDown
return (
<Tooltip title={delta.tooltip}>
<LemonTag
type={delta.direction === 'flat' ? 'muted' : delta.direction === 'up' ? 'success' : 'danger'}
size="small"
icon={<Icon />}
className="tabular-nums"
>
{delta.label}
</LemonTag>
</Tooltip>
)
}
export const ContentAutopilotPromptKpiCard = ({
label,
description,
value,
note,
delta,
'data-attr': dataAttr,
}: KpiCardContent & {
label: string
description: string
'data-attr'?: string
}): JSX.Element => (
<LemonCard hoverEffect={false} className="p-3 flex flex-col gap-1 min-w-0" data-attr={dataAttr}>
<div className="flex items-center justify-between gap-2">
<Tooltip title={description}>
<span className="flex items-center gap-1 min-w-0 text-muted text-xs font-semibold uppercase">
<span className="truncate">{label}</span>
<IconInfo className="shrink-0 text-sm" />
</span>
</Tooltip>
{delta ? <DeltaTag delta={delta} /> : null}
</div>
<span className="text-2xl font-semibold tabular-nums">{value}</span>
<span className="text-muted text-xs">{note}</span>
</LemonCard>
)