Skip to content

: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.

1.3 KB
Raw Blame
import { IconInfo } from '@posthog/icons'
import { Tooltip } from '@posthog/lemon-ui'

/** A label-above-content row used across the readonly config and observation detail cards. */
export function LabeledRow({
    label,
    tooltip,
    aside,
    size = 'small',
    children,
}: {
    label: string
    tooltip?: string
    /** Sits on the label's line, for a qualifier of the value such as the model's confidence. */
    aside?: React.ReactNode
    /** `medium` for the sections a page leads with, such as an observation's question, answer and reasoning. */
    size?: 'small' | 'medium'
    children: React.ReactNode
}): JSX.Element {
    return (
        <div>
            <div
                className={
                    size === 'medium'
                        ? 'flex items-center gap-1.5 text-sm font-semibold text-default mb-1'
                        : 'flex items-center gap-1 text-xs text-muted mb-0.5'
                }
            >
                {label}
                {tooltip && (
                    <Tooltip title={tooltip}>
                        <IconInfo className="text-sm" />
                    </Tooltip>
                )}
                {aside && <span className="ml-1">{aside}</span>}
            </div>
            <div className="text-sm min-w-0">{children}</div>
        </div>
    )
}