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.

feat(experiments): move hypothesis next to results, cap content width (#74189)

Juraj Majerik9b4373d715dc
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 3edfcc6513da..a99cf33edac1 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5879,25 +5879,25 @@ snapshots:
scenes-app-events-mcp-tool-calls--mcp-tool-calls--light:
hash: v1.k794b7964.423e2228f2e2d55107e73c53678f5076d5e7003ac6e9e2c3b420ba1d5bdc9f5d.6MHkzMWpkO6Q8IRSf3BDISXo3179ssSFM_Th3qBJ0Xs
scenes-app-experiments--draft-experiment--dark:
- hash: v1.k794b7964.a9ad31c56a14670f3706873095d20d6a12a7074e37d933ebe6fa56281c9c99fa.wGP5OrONRlm4ahshrjN6fYq95Q2IOK4MYtYkzty_zgk
+ hash: v1.k794b7964.a35223d9d741df27881fcb3ce8e50ac03102be335e24d18ca966d57a5a1d690c.1O6J4xBl6LX_JRZPPW7dD9Chxb1eLy2Grk759HkN2z8
scenes-app-experiments--draft-experiment--light:
- hash: v1.k794b7964.89f93d7c434ed08dc2801d968f6de1e9bffb37004096a61bead2fcba4ee4e85c.3ArSYpnvK9UWCCiSDenPLataou4kVRX5V0fBbaJbjPU
+ hash: v1.k794b7964.74192966b20280489fdc67329370f7c5b675e67a8e18512b61ac71e6c982c0f7.NrgEIHQRT87ytfEBzJVtAVuW3Wn06aWA8erEOgDlmpE
scenes-app-experiments--experiment-asymmetric-intervals--dark:
- hash: v1.k794b7964.f129af72d7cdf7fb28a3a6d467b878405e31f22b09b379e1a62e1a1d0cb8d6ec.lKnUMtWO7t85OVp1GaI_DroZYMf3juae-NpED-VOesA
+ hash: v1.k794b7964.5467f631734e8f360299aa3d5e4a8da5d7ecc2dbe47a5d0727ddfb0dbc9e7ce6.ZGcS-wnQsOO1G4M5I_hw9Aba6YZ1hKpvya9gfWsZvCs
scenes-app-experiments--experiment-asymmetric-intervals--light:
- hash: v1.k794b7964.c9b94bdabaa3775d2112e5e6966f6c732dac13ce851a993b145a23854d2ed001.czC_h39hVPyUrFepYY8zNz1EcKmnaVSoCJuyYsj3Utw
+ hash: v1.k794b7964.595a7efdddc81a3e15f508362a59e9487a3de93950597c714383efc66b6d4e6e.aeWvu1wPNmshDJ_cD8s1hqgaiNAeRROJnYkZu1m2niI
scenes-app-experiments--experiment-frequentist-five-variants--dark:
- hash: v1.k794b7964.018541e3a6fb6f2def4f16def2421f0eb521a3830dc09c790dbca58ead84bba4.im8a_ZC5Q4y6Ek20kh66RjWa7itPzFjIVAp2tDON-0I
+ hash: v1.k794b7964.3e22f4570288ab145bb9ad96e4da9ad237e46a29cfefb3f758d9d7cf8db5a5d0.VPkcfBFukWV6eRSdNZJ65235H8o-OPsAkEmop4q68Co
scenes-app-experiments--experiment-frequentist-five-variants--light:
- hash: v1.k794b7964.2e091d99d187bf9f6b4f2f3f1e62f0a3ea2830b117c660d2cc607f1a163c5e9f.Of14vxuaoTr0wsiZzwU80en2Yca6ed5XMeBHV5q_26Q
+ hash: v1.k794b7964.ca65930ed4fba58aa886be84c0489a0702ef118abac3516ed530db42a772ad71.fp95LwvCUvwV1spa0Back9q7nUlZVypBoc4UMXJh9qc
scenes-app-experiments--experiment-frequentist-two-variants--dark:
- hash: v1.k794b7964.07c8da324c9451584e61905b18ed3cbb06de63707271f6233ab78ffa0978973f.BHd0DbgHUPlh7n-hrPziFLBcnArXuFAdyz1pI4y8H4E
+ hash: v1.k794b7964.fbf1df2e60a7a9bf7aaadb8a463b4bffb7bcc3ac1fda3526d3354c5224b6d9ae.GAeCKzstYDp9qrQI3OU-83C-NDDTM__YuSgKBZxRK64
scenes-app-experiments--experiment-frequentist-two-variants--light:
- hash: v1.k794b7964.e5777aabadb7b44d070c77459cbf0c9e84bac8ce20886c2ac2f0ea8c05287c97.CZfA3hOIqa8DwCtCD0AXSN4uX5KnRT9N9jBPEUAt51w
+ hash: v1.k794b7964.b349b1f26f7d80b19b9772a0b011dfb52f23470ad04cf37b051ee3ff4ad9fdda.b7dOvKFXgBwnaUoLtGjiaVaT6ai_j3-UXDxx3IRcOzw
scenes-app-experiments--experiment-with-funnel-metric--dark:
- hash: v1.k794b7964.92fca47d2a4083066c6a1181ff4c1c31084802c3ae878a65cee1b09856bd8a1d.DRC7fMW43vHGVqCvBUu88ZQjXvpDdWY7lC3_y7CzmM4
+ hash: v1.k794b7964.1e725bd5acc7be5d19a5f22bf08cd4e364822f9d2db47d540e275ae91a701dc0.WoLqVhhEhSieveL0LuILYgB36bwhCaaIkruNs64XNBo
scenes-app-experiments--experiment-with-funnel-metric--light:
- hash: v1.k794b7964.1ff29144435e8755df20b474aa1f5906105ae9a9d1a3e3409e77f9f0ed8cf07b.VBMuLqjMqIDyGHZMhPCL3i-vUYfg7DnLFv3mo_HRWzg
+ hash: v1.k794b7964.8c14414398b3c6b47e0968adeea6d040b7a48c8f7f72d15bcd33392a005ca439.0tOTaEYTCs0PMiFDlR1l4QI6xLkEBXJE6o_kYkPV1BI
scenes-app-experiments--experiment-with-legacy-funnels-query--dark:
hash: v1.k794b7964.6503cdfd33ae5f9d525d14dc8d43b047e8469beca7e5e489534347904efe1dec.2CtGz-wQvIwr_SQDthwlGJI5bVcJ7bFpetJricY-Lps
scenes-app-experiments--experiment-with-legacy-funnels-query--light:
@@ -5907,21 +5907,21 @@ snapshots:
scenes-app-experiments--experiment-with-legacy-trends-query--light:
hash: v1.k794b7964.42c2f3656a5c989d4b1ee34296ca4bb59e186241920a5f8ca21f319069cc6825.6R2u2nPGBnbJYFX2aAn-ZEDtNpa4m1bQA-1aYg8Y7sM
scenes-app-experiments--experiment-with-mean-metric--dark:
- hash: v1.k794b7964.ec972751e9f78b2f919b423422652da923994fe35eab78dbfc732a058187fbdf.Ra0EryMJUqJtGwcNp8cuonVY6sqfcuB25k0G-W46RQg
+ hash: v1.k794b7964.531f25ad73b1a28ac9dd34a14c56ebd7f60ea338d04c31b7abcbc0bb888fae20.qZinILYy_OUWX1rBHEMFlpC9dnm0m07xtskBMq5_XC0
scenes-app-experiments--experiment-with-mean-metric--light:
- hash: v1.k794b7964.bb3ac399075df60b0fdc091648a80e7f09ce491ab2adbb81206b28c44b37b79e.nHbWHTMucVMkSEqZzhDDiy3C6BA6Eep3wpXAxUg7Na4
+ hash: v1.k794b7964.0d066f1db27a8041bea4f1b703a0038234af4b8f76197b37afefb78becae79de.3EV6FQYXIAswfa0spVGKURzGePFgNIFjfsI0Q4KU1QA
scenes-app-experiments--experiment-with-multiple-metrics--dark:
- hash: v1.k794b7964.e4f8cfdb366060146ed83b16fe4a0c5b281fa2f22b70196f36bbb65d85f64845.DjNME1isUfENLslHhs_GPbjYgKoZb_8KvjgxbzfrH3g
+ hash: v1.k794b7964.2bcc5f25af7c8178f4b337e739b27d17b4266711a5ab7fb6ec7211f6fece3108.c5cBK4uVvo8AgqY9t-pB9sOwxH4KIHjAcAKoR0tv9WA
scenes-app-experiments--experiment-with-multiple-metrics--light:
- hash: v1.k794b7964.751c68e91df4d3a6eac448340f9d1b419e2166ea9339e1a71926c57be047c6b5.0_l2thlzDcbct9mbU61dE_Z9WL3wPKVO_nTXHu3tj4Q
+ hash: v1.k794b7964.6cb83522346e9139a4d4a22937117c44151076ce8f6a7b385c2285133731312b.q9mFBAs-mRCLnqf5r5uKd0dkUY9CVIrAr0y6NFWtqjQ
scenes-app-experiments--experiment-with-multiple-metrics-reordered--dark:
- hash: v1.k794b7964.1edc2ba966cbbdf014495d7ac8b19e462a36b72afa64fe599bba60feec227881.0gncGEojuw_19fEQy7qVoLUvud2vWigh1phTlIAkBcE
+ hash: v1.k794b7964.cbd70b40c9fd112364d678bbeef3a294acae69c796c5e24ed68e2ec8f466288a.AYWkA-lSSgSsFpaIAmTZjh8NsLuwqT6oEaSd_XZrD7s
scenes-app-experiments--experiment-with-multiple-metrics-reordered--light:
- hash: v1.k794b7964.e10149c5255dd6481e19726496323e8731c3a5583d322c89afad335d07fe819e.b0KHoURnRQoKDHeI0tNDZ6YK9Igmt8SpmPPlaB56D9I
+ hash: v1.k794b7964.a8a74e26b29f40af5ef40ee6670517de82f297b08915710f24a6e7559d72db58.hzHbun575N0FaJzBeF5HjlO3MwHkz7D5JR6Egi6pdGw
scenes-app-experiments--experiment-with-ratio-metric--dark:
- hash: v1.k794b7964.997e9f0e08a07e8cef816559a51e30818e0500b6f986d840f7719a4383bb0a79.n9hmduRLQ7-IL9cxRRBBQaNdTJblDNwq7OGBxpgAmvo
+ hash: v1.k794b7964.5f615cd14d90bd13d4aaf4d23cad132c8808965cc3fc1b639dc6ce7e05756bf1.z2rKr_3rlC2Z_oZh1fxKt1d2t0S_fuwgrSyhRO1xsr0
scenes-app-experiments--experiment-with-ratio-metric--light:
- hash: v1.k794b7964.c883f124a0e4bdbb4f00c06e3fd93eefd1163374c85d641b4ceb89b16a8d4282.0TIE5gMSyKa2aXPJkYC7nu9_6gBHInLDy1UgqseO_hA
+ hash: v1.k794b7964.2e2dff597a499b51b8db08087d3c9610dcda4e5ecbd4f8bd809f6408e33a8d73.f0AqCDPbxx5XMVZ0S1K6bDRSIPDipNneYyTQVQhoBtE
scenes-app-experiments--experiments--dark:
hash: v1.k794b7964.bb7a67466cb94c2155158d13444e7f6f473d8176c5823908c467b2d19c0f3ac9.uPI1H-JnVAqnEUTczdLstoglvGWvSOBV5k4w-FXpLWc
scenes-app-experiments--experiments--light:
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx
index 154c043be258..4b985c6ef55f 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx
@@ -38,6 +38,7 @@ import { ExperimentReplayTab } from './ExperimentReplayTab'
import { ExperimentWarningBanner } from './ExperimentWarningBanners'
import { ExposureCriteriaModal } from './ExposureCriteria'
import { Exposures } from './Exposures'
+import { Hypothesis } from './Hypothesis'
import { Info } from './Info'
import { LoadingState } from './LoadingState'
import { MultiVariantBiasWarning } from './MultiVariantBiasWarning'
@@ -86,9 +87,12 @@ const MetricsTab = (): JSX.Element => {
<>
<ResultsNotificationBanner />
- <div className="w-full mb-4">
- <Exposures />
- <MultiVariantBiasWarning />
+ <div className="w-full mb-4 flex flex-col gap-4">
+ <Hypothesis />
+ <div>
+ <Exposures />
+ <MultiVariantBiasWarning />
+ </div>
</div>
{showRecalculationStatus && <RecalculationStatus experiment={experiment} />}
@@ -256,7 +260,15 @@ export function ExperimentView(): JSX.Element {
activeKey={tabs.some((tab) => tab.key === activeTabKey) ? activeTabKey : 'metrics'}
onChange={(key) => setActiveTabKey(key)}
sceneInset
- tabs={tabs}
+ // Keep the tab bar full-width, but cap the content under each tab for readability
+ tabs={tabs.map((tab) =>
+ 'content' in tab
+ ? {
+ ...tab,
+ content: <div className="w-full max-w-[1400px] mx-auto">{tab.content}</div>,
+ }
+ : tab
+ )}
/>
{/* Modern experiment modals */}
diff --git a/frontend/src/scenes/experiments/ExperimentView/Hypothesis.tsx b/frontend/src/scenes/experiments/ExperimentView/Hypothesis.tsx
new file mode 100644
index 000000000000..0f95682dc044
--- /dev/null
+++ b/frontend/src/scenes/experiments/ExperimentView/Hypothesis.tsx
@@ -0,0 +1,78 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useState } from 'react'
+
+import { IconPencil } from '@posthog/icons'
+import { LemonButton, LemonModal } from '@posthog/lemon-ui'
+
+import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea/LemonTextArea'
+
+import { experimentLogic } from '../experimentLogic'
+import { modalsLogic } from '../modalsLogic'
+
+export function Hypothesis(): JSX.Element {
+ const { experiment } = useValues(experimentLogic)
+ const { updateExperiment } = useActions(experimentLogic)
+ const { openDescriptionModal, closeDescriptionModal } = useActions(modalsLogic)
+ const { isDescriptionModalOpen } = useValues(modalsLogic)
+
+ const [tempDescription, setTempDescription] = useState(experiment.description || '')
+
+ useEffect(() => {
+ setTempDescription(experiment.description || '')
+ }, [experiment.description])
+
+ return (
+ <div className="border border-primary rounded bg-[var(--color-bg-table)] px-3 py-2.5">
+ <div className="flex items-center gap-1">
+ <span className="metric-cell-header font-bold">Hypothesis</span>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ icon={<IconPencil className="text-secondary" />}
+ tooltip="Edit hypothesis"
+ onClick={openDescriptionModal}
+ />
+ </div>
+ {experiment.description ? (
+ <p className="metric-cell font-normal m-0 mt-1 leading-relaxed whitespace-pre-wrap">
+ {experiment.description}
+ </p>
+ ) : (
+ <p className="metric-cell font-normal m-0 mt-1 leading-relaxed italic">
+ Add your hypothesis for this test
+ </p>
+ )}
+
+ <LemonModal
+ isOpen={isDescriptionModalOpen}
+ onClose={closeDescriptionModal}
+ title="Edit hypothesis"
+ footer={
+ <div className="flex items-center gap-2 justify-end">
+ <LemonButton type="secondary" onClick={closeDescriptionModal}>
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ onClick={() => {
+ updateExperiment({ description: tempDescription })
+ closeDescriptionModal()
+ }}
+ >
+ Save
+ </LemonButton>
+ </div>
+ }
+ >
+ <LemonTextArea
+ className="w-full"
+ value={tempDescription}
+ onChange={(value) => setTempDescription(value)}
+ placeholder="Add your hypothesis for this test"
+ minRows={6}
+ maxLength={3000}
+ />
+ </LemonModal>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/experiments/ExperimentView/Info.tsx b/frontend/src/scenes/experiments/ExperimentView/Info.tsx
index 964a539fb8c3..2893c5b48eb2 100644
--- a/frontend/src/scenes/experiments/ExperimentView/Info.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/Info.tsx
@@ -1,15 +1,12 @@
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
-import { useEffect, useState } from 'react'
import { IconPencil, IconWarning } from '@posthog/icons'
-import { LemonButton, LemonModal, LemonTag, Link, ProfilePicture, Tooltip } from '@posthog/lemon-ui'
+import { LemonButton, LemonTag, Link, ProfilePicture, Tooltip } from '@posthog/lemon-ui'
import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
import { IconOpenInNew } from 'lib/lemon-ui/icons'
-import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea/LemonTextArea'
import { Label } from 'lib/ui/Label/Label'
-import { cn } from 'lib/utils/css-classes'
import { urls } from 'scenes/urls'
import { ExperimentStatsMethod, ExperimentStatus } from '~/types'
@@ -85,16 +82,7 @@ export function Info(): JSX.Element {
isSingleVariantShipped,
shippedVariantKey,
} = useValues(experimentLogic)
- const { updateExperiment } = useActions(experimentLogic)
- const { openEditConclusionModal, openDescriptionModal, closeDescriptionModal, openRunningTimeConfigModal } =
- useActions(modalsLogic)
- const { isDescriptionModalOpen } = useValues(modalsLogic)
-
- const [tempDescription, setTempDescription] = useState(experiment.description || '')
-
- useEffect(() => {
- setTempDescription(experiment.description || '')
- }, [experiment.description])
+ const { openEditConclusionModal, openRunningTimeConfigModal } = useActions(modalsLogic)
const { created_by } = experiment
@@ -188,54 +176,6 @@ export function Info(): JSX.Element {
</span>
</div>
</div>
-
- <div className="max-w-[500px]">
- <div className="flex items-center gap-2 mt-2">
- <Label intent="menu">Hypothesis</Label>
- <LemonButton
- type="secondary"
- size="xsmall"
- icon={<IconPencil />}
- onClick={openDescriptionModal}
- />
- </div>
- {experiment.description ? (
- <p className={cn('m-0 mt-2')}>{experiment.description}</p>
- ) : (
- <p className={cn('m-0 mt-2 text-secondary italic')}>Add your hypothesis for this test</p>
- )}
-
- <LemonModal
- isOpen={isDescriptionModalOpen}
- onClose={closeDescriptionModal}
- title="Edit hypothesis"
- footer={
- <div className="flex items-center gap-2 justify-end">
- <LemonButton type="secondary" onClick={closeDescriptionModal}>
- Cancel
- </LemonButton>
- <LemonButton
- type="primary"
- onClick={() => {
- updateExperiment({ description: tempDescription })
- closeDescriptionModal()
- }}
- >
- Save
- </LemonButton>
- </div>
- }
- >
- <LemonTextArea
- className="w-full"
- value={tempDescription}
- onChange={(value) => setTempDescription(value)}
- placeholder="Add your hypothesis for this test"
- minRows={6}
- maxLength={3000}
- />
- </LemonModal>
- </div>
</div>
{/* Column 2 */}