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.

11.1 KB
Raw Blame
.InsightViz {
    display: flex;
    flex: 1; // important for when rendered within a flex parent
    flex-direction: column;
    gap: 1rem;
    container-type: inline-size;
    container-name: insight-viz;

    .PropertyGroupFilters__add-filter-group-inline {
        display: block;
    }

    .PropertyGroupFilters__add-filter-group-after {
        display: none;
    }

    &.InsightViz--horizontal {
        flex-flow: row wrap;
        align-items: flex-start;

        .EditorFiltersWrapper {
            width: 100%;

            &.EditorFiltersWrapper--panels {
                // Hide empty ConfigFilter wrappers (e.g. SmoothingFilter on week/month)
                .InsightDisplayConfig span.deprecated-space-x-2:empty {
                    display: none;
                }

                // Hide the inline add-filter-group wrapper so it doesn't add gap-2 spacing
                .PropertyGroupFilters__add-filter-group-inline-wrapper {
                    display: none;
                }

                // Allow property filter to shrink next to the X button
                .property-filter-row .TaxonomicPropertyFilter {
                    flex: 1;
                    width: auto;
                    min-width: 0;
                }

                // ...but a row with a sibling entry point keeps the two buttons adjacent
                .property-filter-row--with-suffix .TaxonomicPropertyFilter {
                    flex: 0 0 auto;
                }

                // Propagate min-width:0 through the filter chain
                .ActionFilterRow,
                .ActionFilterRow-filters,
                .ActionFilterGroup--events-list {
                    min-width: 0;
                }

                @container insight-viz (min-width: 900px) {
                    width: var(--editor-panel-width, max(min(30%, 600px), 420px));
                    min-width: 320px;
                    max-width: 600px;
                }

                @container editor-panel (max-width: 500px) {
                    // Inline events: property filter row wraps below "where"
                    .ActionFilterGroup--events-list .TaxonomicPropertyFilter__row {
                        flex-wrap: wrap;
                    }

                    .ActionFilterGroup--events-list .TaxonomicPropertyFilter__row-items {
                        flex-basis: 100%;
                    }

                    // The empty row keeps "where + Filter" as one unit so the suffix button wraps below it
                    .ActionFilterGroup--events-list .property-filter-row--with-suffix .TaxonomicPropertyFilter__row {
                        flex-wrap: nowrap;
                    }

                    .ActionFilterGroup--events-list
                        .property-filter-row--with-suffix
                        .TaxonomicPropertyFilter__row-items {
                        flex-basis: auto;
                    }
                }

                @container editor-panel (max-width: 400px) {
                    .ActionFilterRow-filters .TaxonomicPropertyFilter__row {
                        flex-wrap: wrap;
                    }

                    .ActionFilterRow-filters .TaxonomicPropertyFilter__row-items {
                        flex-basis: 100%;
                    }

                    .ActionFilterRow-filters .TaxonomicPropertyFilter__row-operator {
                        justify-content: flex-start;
                        width: auto;
                        height: auto;
                    }

                    .ActionFilterRow-filters .TaxonomicPropertyFilter__row-operator--empty {
                        display: none;
                    }

                    .ActionFilterRow-filters .property-filter-row--with-suffix .TaxonomicPropertyFilter__row {
                        flex-wrap: nowrap;
                    }

                    .ActionFilterRow-filters .property-filter-row--with-suffix .TaxonomicPropertyFilter__row-items {
                        flex-basis: auto;
                    }
                }
            }

            &:not(.EditorFiltersWrapper--panels) {
                @container (min-width: 768px) {
                    width: 30%;
                    min-width: 26rem;
                    max-width: 30rem;
                }
            }
        }

        // If horizontal, hide the inline add filter group button and display the one after
        .PropertyGroupFilters__add-filter-group-inline {
            display: none;
        }

        .PropertyGroupFilters__add-filter-group-after {
            display: block;
        }
    }
}

.InsightVizDisplay {
    --insight-viz-min-height: min(calc(80vh - 6rem), 32rem);

    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;

    .NotebookNode &,
    .MarkdownNotebook__real-node &,
    .InsightCard &,
    .ExportedInsight &,
    .WebAnalyticsDashboard &,
    .HomeTabDefaultChart & {
        flex: 1;
        height: 100%;

        .LineGraph {
            padding: 0.5rem;
        }
    }

    .InsightVizDisplay__content {
        position: relative;
        display: flex;
        flex: 1;
        flex-direction: column;
        height: 100%;
        padding: 0.5rem;

        &--with-legend {
            flex-direction: row;
        }

        .InsightVizDisplay__content__left {
            position: relative;
            display: flex;
            flex: 1;
            flex-direction: column;
            width: 100%;
        }

        .InsightVizDisplay__content__right {
            display: flex;
            flex-shrink: 1;
            align-items: center;
            width: fit-content;
            max-width: 45%;
            max-height: var(--insight-viz-min-height);
            margin: 1rem;
        }
    }

    .InsightDisplayConfig {
        padding: 0.5rem;
        border-bottom-width: 1px;
    }
}

.WebAnalyticsDashboard {
    .InsightVizDisplay {
        --insight-viz-min-height: 25rem;
    }

    .WebTile--short-chart .InsightVizDisplay {
        --insight-viz-min-height: 18rem;
    }
}

.RevenueAnalyticsDashboard {
    .InsightVizDisplay {
        --insight-viz-min-height: 20rem;
    }
}

.HomeTabDefaultChart {
    .InsightVizDisplay {
        --insight-viz-min-height: 24rem;
    }
}

.RetentionContainer {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;

    .RetentionContainer__graph {
        // Flex column so the hog-charts wrapper (inline `flex: 1`) fills it.
        // min-height lives here, not on .LineGraph, because the wrapper's inline
        // `min-height: 0` would override a class rule set directly on .LineGraph.
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 30vh;
        margin: 0.5rem;
    }

    .RetentionContainer__table {
        flex-shrink: 0;
    }

    .LineGraph {
        position: relative !important;
        width: 100% !important;
    }

    .NotebookNode &,
    .MarkdownNotebook__real-node &,
    .InsightCard &,
    .ExportedInsight &,
    .WebAnalyticsDashboard & {
        .RetentionContainer__graph {
            min-height: 100px;
        }

        .LineGraph {
            position: relative;
        }
    }
}

.TrendsInsight {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    height: var(--insight-viz-min-height);

    // Explicit height (not just min/max) so a top/bottom in-chart legend's max-height: 40% cap resolves —
    // a flex-derived used size does not count, and without it the legend stretches the chart taller.
    min-height: var(--insight-viz-min-height);
    max-height: var(--insight-viz-min-height);
    margin: 0.5rem;

    .NotebookNode &,
    .InsightCard &,
    .ExportedInsight &,
    .WebAnalyticsDashboard &,
    .HomeTabDefaultChart & {
        height: auto;
        min-height: auto;
        max-height: none;
    }

    &--ActionsTable,
    &--WorldMap,
    &--BoldNumber,
    &--Metric {
        height: auto;
        min-height: auto;
        max-height: none;
        margin: 0;
    }

    &--ActionsBarValue {
        // Keep the standard height as a floor so a few-row chart still fills it (a single bar
        // shouldn't shrink), but drop the height/max-height cap so many breakdown rows grow the
        // container instead of being clipped.
        height: auto;
        min-height: var(--insight-viz-min-height);
        max-height: none;
    }

    &--BoldNumber {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

// In the exporter the trends wrapper is `.InsightCard__viz` (embedded), which is flex-sized with no
// definite height — so a bottom in-chart legend's `max-height: 40%` cap can't resolve and the plot
// stretches the card taller and taller. Pin a viewport height on the displays that draw the in-chart
// legend so the exported chart stays a bounded, page-filling card (mirrors `.TrendsInsight`'s explicit
// height in the app). Table/world map/number/metric are excluded — they size to content or are their
// own card. `8rem` leaves room for the export header and padding above the chart.
.ExportedInsight {
    .InsightCard__viz--ActionsLineGraph,
    .InsightCard__viz--ActionsLineGraphCumulative,
    .InsightCard__viz--ActionsAreaGraph,
    .InsightCard__viz--ActionsBar,
    .InsightCard__viz--ActionsUnstackedBar,
    .InsightCard__viz--ActionsPie,
    .InsightCard__viz--ActionsProportionBar {
        height: calc(100vh - 8rem);
    }
}

// Drop the viz padding for displays that bleed to the card edges: the Metric sparkline, and the
// results table, whose full-width header and row separators would otherwise stop short of the border.
.InsightVizDisplay__content:has(.Metric),
.InsightVizDisplay__content:has(.TrendsInsight--ActionsTable),
.InsightVizDisplay__content:has(.InsightCard__viz--ActionsTable) {
    padding: 0;
}

.FunnelInsight {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;

    &--type-steps-vertical,
    &--type-steps-flow,
    &--type-time_to_convert,
    &--type-trends {
        min-height: var(--insight-viz-min-height);

        .NotebookNode &,
        .MarkdownNotebook__real-node & {
            min-height: 0;
        }

        .InsightCard &,
        .ExportedInsight &,
        .WebAnalyticsDashboard & {
            min-height: auto;
        }
    }
}

.funnel-significance-highlight {
    display: inline-flex;
    color: var(--text-3000-light);
    background: var(--color-accent);

    .LemonIcon {
        color: var(--text-3000-light);
    }
}

.ErrorTracking__breakdowns,
.ErrorTracking__insights {
    .InsightViz {
        align-items: stretch;
        height: 100%;
    }

    // An embedded query renders `.InsightCard__viz` instead of `.InsightViz`, and that wrapper carries
    // no sizing of its own. Give it the same full-height flex column, or the chart collapses to its
    // content height and leaves the bottom of the card empty.
    .InsightCard__viz {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .InsightVizDisplay {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .InsightVizDisplay__content {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 0;
    }

    .TrendsInsight {
        flex: 1;
        min-height: 0;
    }
}