: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 { IconPlusSmall } from '@posthog/icons'
import { ButtonPrimitive, ButtonPrimitiveProps } from 'lib/ui/Button/ButtonPrimitives'
import { SceneDataAttrKeyProps } from '../utils'
type SceneAddToDashboardButtonProps = SceneDataAttrKeyProps &
Pick<ButtonPrimitiveProps, 'disabledReasons'> & {
dashboard?: {
onClick?: () => void
}
}
export function SceneAddToDashboardButton({
dataAttrKey,
dashboard,
disabledReasons,
}: SceneAddToDashboardButtonProps): JSX.Element | null {
if (!dashboard) {
return null
}
return (
<ButtonPrimitive
menuItem
onClick={() => {
dashboard.onClick?.()
}}
data-attr={`${dataAttrKey}-add-to-dashboard-button`}
disabledReasons={disabledReasons}
>
<IconPlusSmall /> Add to dashboard
</ButtonPrimitive>
)
}