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.

6.0 KB
Raw Blame
.DashboardTileCard {
    min-height: 0;
}

.CardMeta {
    position: relative;
    z-index: var(--z-raised); // Elevate above viz
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 100%;
    max-height: calc(100% - 2rem);
    background: var(--color-bg-surface-primary);
    border-radius: var(--radius);

    h5 {
        margin-bottom: 0;
        overflow: hidden;
        line-height: 1rem;
        color: var(--color-text-secondary);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    h4 {
        height: 1.5em;
        margin-bottom: 0.125rem;
        overflow: hidden;
        font-size: 1rem;
        font-weight: 600;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .CardMeta__primary {
        display: flex;
        width: 100%;
        min-width: 0;
        padding: 1rem;
    }

    .CardMeta__divider {
        height: 1px;
        margin: 0 1rem;
        background: var(--color-border-primary);
        opacity: 0;
        transition: opacity 200ms ease;
    }

    .CardMeta__details {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        max-height: 24rem;
        margin-top: -1px; // To cause overlap with the divider when closed
        margin-right: -1px; // To align with the CardMeta borders
        margin-left: -1px; // To align with the CardMeta borders
        overflow-y: auto;
        background: var(--color-bg-surface-primary);
        border-right: 1px solid var(--color-border-primary);
        border-bottom: 1px solid var(--color-border-primary);
        border-left: 1px solid var(--color-border-primary);
        border-radius: var(--radius);
        transition:
            box-shadow 200ms ease,
            height 200ms ease,
            margin 200ms ease;

        .CardMeta__details__content {
            overflow-y: auto;
            pointer-events: none;
        }
    }

    &.CardMeta--compact {
        container-type: inline-size;

        .CardMeta__primary {
            padding: 0.5rem 2.5rem 0.125rem 0.75rem;
        }

        .CardMeta__ribbon {
            width: 0.25rem;
            margin: 0 0.5rem 0.25rem -0.25rem;
        }

        .CardMeta__heading {
            display: none;
            font-family: var(--font-title);
            font-size: 0.6875rem;
            font-weight: 700;
            line-height: 1rem;
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }

        .CardMeta__top {
            height: auto;
        }

        .CardMeta__controls {
            position: absolute;
            top: 0.5rem;
            right: 0.75rem;

            // Opaque strip so the hover-revealed refresh icon sits over (not garbles) the title tail.
            background: var(--color-bg-surface-primary);
        }

        .CardMeta__divider {
            margin: 0;
            opacity: 1;
        }

        h4 {
            height: auto;
            margin: 0;
        }

        &.CardMeta--header-status {
            .CardMeta__primary {
                gap: 0.25rem;
                padding-right: 0.75rem;
            }

            .CardMeta__main {
                flex: 1;
            }

            .CardMeta__controls {
                position: static;
                flex-shrink: 0;
                align-self: flex-start;

                .LemonButton {
                    height: 1.75rem;
                }
            }
        }

        @container (min-width: 14rem) {
            .CardMeta__heading {
                // Let the top-heading row participate in CardMeta__top flex layout without an extra wrapper box.
                display: contents;
            }
        }
    }

    &.CardMeta--details-shown {
        .CardMeta__details {
            margin-top: 0;
            box-shadow: var(--shadow-elevation-3000);

            .CardMeta__details__content {
                pointer-events: all;
                opacity: 1;
            }
        }

        .CardMeta__divider {
            opacity: 1;
        }
    }
}

.CardMeta__ribbon {
    flex-shrink: 0;
    align-self: stretch;
    width: 0.375rem;
    margin: 0 0.75rem 0 -0.25rem;
    background: var(--color-text-secondary); // Just a fallback value in case there's some unrecognized value
    border-radius: var(--radius);

    &.blue {
        background: var(--blue);
    }

    &.purple {
        background: var(--purple);
    }

    &.green {
        background: var(--green);
    }

    &.black {
        background: var(--black);
    }
}

.CardMeta__main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
    height: fit-content;
    min-height: 2rem;

    > * {
        max-width: 100%; // Make sure that horizontal overflow is capped, so that ellipsis on insight name works
    }
}

.CardMeta__top {
    display: flex;
    align-items: center;
    align-self: stretch;
    justify-content: space-between;
    height: 1.5rem;

    .LemonButton {
        height: 1.75rem;
    }
}

.CardMeta__controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

// Refresh control is hidden at rest and revealed only when hovering the tile header.
// Use `visibility` (not `opacity`) so a disabled LemonButton's own opacity override
// — which kicks in once a refreshed tile is rate-limited — can't keep it visible.
// Keyboard/touch users reach refresh via the always-present "⋯" menu.
.CardMeta__refresh {
    visibility: hidden;
}

.CardMeta:hover .CardMeta__refresh {
    visibility: visible;
}

// On compact tiles too narrow to fit the icon without overlapping the title, keep it hidden
// even on hover — refresh stays available in the "⋯" menu. The container is only established in
// compact mode, so this never applies to the non-compact (saved insights) layout.
@container (max-width: 22rem) {
    .CardMeta:hover .CardMeta__refresh {
        visibility: hidden;
    }

    .CardMeta--header-status .CardMeta__refresh {
        display: none;
    }
}