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.

3.1 KB
Raw Blame
.ScrollableShadows {
    --scrollable-shadows-offset-top: 0px;

    // Reset shadow custom properties so nested ScrollableShadows don't inherit
    // the parent's shadow values via CSS custom property inheritance.
    --shadow-x-start: 0 0 0 0 transparent;
    --shadow-x-end: 0 0 0 0 transparent;
    --shadow-y-start: 0 0 0 0 transparent;
    --shadow-y-end: 0 0 0 0 transparent;

    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;

    // Base UI ScrollArea injects `.base-ui-disable-scrollbar` on the Viewport
    // which hides native scrollbars. Restore them unless explicitly hidden.
    &:not(.ScrollableShadows--hide-scrollbars) {
        .ScrollableShadows__inner.base-ui-disable-scrollbar {
            scrollbar-width: auto;

            &::-webkit-scrollbar {
                display: block;
            }
        }
    }

    .ScrollableShadows__inner {
        flex: 1;
    }

    // Shadow pseudo-elements driven by Base UI's data-overflow-* attributes.
    // ::before handles start shadows (left + top), ::after handles end shadows (right + bottom).
    // Each shadow is independently toggled via CSS custom properties.
    &::before,
    &::after {
        position: absolute;
        top: var(--scrollable-shadows-offset-top);
        left: 0;
        z-index: 8; // 8 because we want it over lemon table headers/rows & other stuff
        width: 100%;
        height: 100%;
        pointer-events: none;
        content: '';
        transition: box-shadow 200ms ease;
    }

    &:not(.ScrollableShadows--hide-shadows) {
        &::before {
            box-shadow:
                var(--shadow-x-start, 0 0 0 0 transparent) inset,
                var(--shadow-y-start, 0 0 0 0 transparent) inset;
        }

        &::after {
            box-shadow:
                var(--shadow-x-end, 0 0 0 0 transparent) inset,
                var(--shadow-y-end, 0 0 0 0 transparent) inset;
        }

        &[data-overflow-x-start] {
            --shadow-x-start: 16px 0 16px -16px rgb(0 0 0 / 25%);
        }

        &[data-overflow-x-end] {
            --shadow-x-end: -16px 0 16px -16px rgb(0 0 0 / 25%);
        }

        &[data-overflow-y-start] {
            --shadow-y-start: 0 16px 16px -16px rgb(0 0 0 / 25%);
        }

        &[data-overflow-y-end] {
            --shadow-y-end: 0 -16px 16px -16px rgb(0 0 0 / 25%);
        }

        [theme='dark'] & {
            &[data-overflow-x-start] {
                --shadow-x-start: 16px 0 16px -16px rgb(0 0 0 / 100%);
            }

            &[data-overflow-x-end] {
                --shadow-x-end: -16px 0 16px -16px rgb(0 0 0 / 100%);
            }

            &[data-overflow-y-start] {
                --shadow-y-start: 0 16px 16px -16px rgb(0 0 0 / 100%);
            }

            &[data-overflow-y-end] {
                --shadow-y-end: 0 -16px 16px -16px rgb(0 0 0 / 100%);
            }
        }
    }

    &.ScrollableShadows--hide-scrollbars {
        .ScrollableShadows__inner {
            scrollbar-width: none;

            &::-webkit-scrollbar {
                display: none;
            }
        }
    }
}