Cards & content / Media & mockups

Perspective Floating App Window

Dark chat-app mockup tilted in perspective with deep black drop shadow: icon rail, chat list sidebar, central composer and right sub-agents panel, plus a model-picker popover.

Rebuilt from silico.ai in the Moonlit Atelier style.

npx shadcn@latest add https://justyoink.it/r/moonlit-atelier/blocks/tilted-app-window.json

Looks exactly like silico.ai: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: title, placeholder, caption, chats (string[]) and models ({name,dots,color}[]). The popover fades in once when scrolled into view; the Auto button toggles it and rotates its chevron 180°.

components/tilted-app-window.tsx
"use client";

import { useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
import { useState, useEffect, useRef } from "react";

type Model = { name: string; dots: number; color: string };

export default function PerspectiveFloatingAppWindow({
  title = "Quarterly roadmap sync",
  placeholder = "Message Orbit…",
  caption = "One prompt, several helpers, a finished plan. Illustrative run in the Orbit workspace.",
  chats = ["Quarterly roadmap sync", "Design review notes", "Compare vendor quotes", "Onboarding checklist", "Weekly metrics digest", "Tidy contact list"],
  models = [
    { name: "aria-large-4", dots: 3, color: "#e08a64" },
    { name: "aria-pro-4.1", dots: 4, color: "#e08a64" },
    { name: "nova-7-mini", dots: 3, color: "#4cb8a0" },
    { name: "lyra-2-flash", dots: 3, color: "#6a8cf0" },
    { name: "cedar-v3-0812", dots: 1, color: "#7a7ff0" },
  ] as Model[],
}) {
  const [open, setOpen] = useState(true);
  const [shown, setShown] = useState(false);
  const ref = useRef<HTMLDivElement>(null);
  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver(([e]) => {
      if (e.isIntersecting) { setShown(true); io.disconnect(); }
    }, { threshold: 0.3 });
    io.observe(el);
    return () => io.disconnect();
  }, []);
  const [mode, setMode] = useState("Max");
  return (
    <section ref={ref} className="relative overflow-hidden bg-canvas px-4 py-16 font-sans text-primary">
      <Reveal from="up">
        <div className="mx-auto max-w-5xl [perspective:1600px]">
          <div className="relative overflow-hidden rounded-xl border border-hairline bg-surface shadow-float-window [transform:rotateY(-8deg)_rotateX(3deg)] [transform-origin:left_center]">
            <div className="flex h-[520px]">
              <div className="flex w-12 flex-col items-center gap-5 border-r border-hairline bg-canvas-warm py-4">
                <span className="h-5 w-5 rounded-full border-2 border-primary" />
                {[0, 1, 2, 3, 4].map((i) => (
                  <span key={i} className={`h-3.5 w-3.5 rounded-sm border ${i === 0 ? "border-primary" : "border-muted"}`} />
                ))}
              </div>
              <aside className="hidden w-52 shrink-0 border-r border-hairline bg-canvas-warm p-3 sm:block">
                <button className="mb-4 w-full rounded-md border border-hairline bg-surface-raised px-3 py-1.5 text-left text-caption text-secondary focus-visible:outline focus-visible:outline-1">+ New chat</button>
                <p className="mb-1 px-2 text-caption text-muted">Today</p>
                {chats.map((c, i) => (
                  <div key={c} className={`truncate rounded-md px-2 py-1.5 text-caption ${i === 0 ? "bg-surface-raised text-primary" : "text-secondary"}`}>{c}</div>
                ))}
              </aside>
              <div className="relative flex min-w-0 flex-1 flex-col">
                <div className="border-b border-hairline px-4 py-3 text-caption text-primary">{title}</div>
                <div className="relative flex-1">
                  {open && (
                    <div
                      className="absolute bottom-2 left-4 w-72 max-w-[calc(100%-2rem)] rounded-lg border border-hairline bg-canvas-warm p-1 shadow-float-window transition-[opacity,transform] duration-[280ms] ease-linear"
                      style={{ opacity: shown ? 1 : 0, transform: shown ? "none" : "translateY(6px) scale(0.98)" }}
                    >
                      <div className="flex justify-between border-b border-hairline px-2 py-2 text-caption text-muted"><span>Search models…</span><span>307</span></div>
                      <div className="mt-1 rounded-md bg-surface-raised px-2 py-1.5">
                        <p className="text-caption text-primary">Auto (best quality)</p>
                        <p className="text-caption text-muted">Orbit picks the best model</p>
                      </div>
                      {models.map((m) => (
                        <div key={m.name} className="flex items-center gap-2 px-2 py-1.5 text-caption text-secondary">
                          <span className="h-3 w-3 rounded-full" style={{ background: m.color }} />
                          <span className="flex-1 font-mono">{m.name}</span>
                          <span className="flex gap-0.5">{[0, 1, 2, 3].map((d) => <i key={d} className={`h-1 w-1 rounded-full ${d < m.dots ? "bg-primary" : "bg-faint"}`} />)}</span>
                        </div>
                      ))}
                    </div>
                  )}
                </div>
                <div className="flex gap-2 px-4 pb-2">
                  <button aria-expanded={open} onClick={() => setOpen(!open)} className="flex items-center gap-1 rounded-pill border border-hairline px-3 py-1 text-caption text-primary focus-visible:outline focus-visible:outline-1">
                    Auto
                    <svg width="10" height="10" viewBox="0 0 10 10" className={`transition-transform duration-[180ms] ease-[cubic-bezier(0.23,1,0.32,1)] ${open ? "rotate-180" : ""}`} fill="none" stroke="currentColor" strokeWidth="1.5"><path d="M2 6l3-3 3 3" /></svg>
                  </button>
                  <div className="flex overflow-hidden rounded-pill border border-hairline text-caption">
                    {["Default", "Max"].map((m) => (
                      <button key={m} onClick={() => setMode(m)} className={`px-3 py-1 ${mode === m ? "bg-surface-raised text-primary" : "text-muted"}`}>{m}</button>
                    ))}
                  </div>
                </div>
                <div className="mx-3 mb-3 rounded-xl border border-hairline bg-surface-high p-3">
                  <p className="text-body text-muted">{placeholder}</p>
                  <div className="mt-4 flex items-center justify-between">
                    <span className="text-lead text-muted">+</span>
                    <button aria-label="Send" className="flex h-9 w-9 items-center justify-center rounded-full bg-paper text-canvas">
                      <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.8"><path d="M8 13V3M3.5 7.5L8 3l4.5 4.5" /></svg>
                    </button>
                  </div>
                </div>
              </div>
              <aside className="hidden w-56 shrink-0 border-l border-hairline bg-canvas-warm md:block">
                <p className="px-4 pt-3 text-caption text-muted">Sandbox 3c81d0e</p>
                <div className="flex gap-4 border-b border-hairline px-4 pt-2 text-caption">
                  <span className="pb-2 text-muted">Files</span>
                  <span className="border-b border-primary pb-2 text-primary">Sub-agents</span>
                </div>
              </aside>
            </div>
          </div>
          <p className="mt-6 text-center text-caption text-muted">{caption}</p>
        </div>
      </Reveal>
    </section>
  );
}

// ---- Yoink motion (inlined, no dependencies): Reveal ----

const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)";

const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;

function ykReducedMotion(): boolean {
  return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
}

// "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance.
// Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed,
// and there is a box to watch), and a safety net reveals anything on screen that is still hidden.
type YkRevealState = "idle" | "hidden" | "shown";

function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState {
  const [state, setState] = useState<YkRevealState>("idle");
  useYkLayoutEffect(() => {
    const el = ref.current;
    if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return;
    // watch the element's own box, or its children when it has none (display: contents)
    const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]);
    const onScreen = (t: Element) => {
      const r = t.getBoundingClientRect();
      return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth;
    };
    if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible
    let shown = false;
    const show = (v: boolean) => {
      if (v !== shown) (shown = v), setState(v ? "shown" : "hidden");
    };
    setState("hidden");
    const inView = new Set<Element>();
    const io = new IntersectionObserver((entries) => {
      for (const e of entries) {
        if (e.isIntersecting) inView.add(e.target);
        else inView.delete(e.target);
      }
      if (inView.size) {
        show(true);
        if (once) io.disconnect();
      } else if (!once) show(false);
    });
    const watched = new Set<Element>();
    const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t)));
    watch();
    // safety net: styles that land after mount (display: contents) get watched too, and nothing
    // stays hidden for more than a moment while it is actually on screen
    const start = Date.now();
    const net = setInterval(() => {
      if (shown) return once && clearInterval(net);
      watch();
      if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true);
    }, 600);
    return () => {
      io.disconnect();
      clearInterval(net);
    };
  }, [once]);
  return state;
}

type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none";

/** Fades content in as it scrolls into view. */
function Reveal({
  children,
  from = "up",
  delay = 0,
  duration = 700,
  distance = 24,
  once = true,
  as = "div",
  className,
  style,
}: {
  children?: ReactNode;
  from?: YkRevealFrom;
  delay?: number;
  duration?: number;
  distance?: number;
  once?: boolean;
  as?: ElementType;
  className?: string;
  style?: CSSProperties;
}) {
  const Tag = as;
  const ref = useRef<HTMLElement>(null);
  const state = useYkReveal(ref, once);
  const hidden = state === "hidden";
  const offset = {
    up: `translate3d(0, ${distance}px, 0)`,
    down: `translate3d(0, ${-distance}px, 0)`,
    left: `translate3d(${-distance}px, 0, 0)`,
    right: `translate3d(${distance}px, 0, 0)`,
    scale: "scale(0.94)",
    blur: `translate3d(0, ${distance / 2}px, 0)`,
    none: "none",
  }[from];
  const t = `${duration}ms ${YK_EASE} ${delay}ms`;
  return (
    <Tag
      ref={ref}
      className={className}
      style={{
        ...style,
        ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }),
        ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }),
      }}
    >
      {children}
    </Tag>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Moonlit Atelier

The whole style →

Inline Update Strip

Changelog

Hairline Capability Grid

Lists

Painted Landscape Hero

Heroes

Transparent Minimal Nav Bar

Headers & nav bars

Dark Prompt Composer

Prompt & chat inputs

Model Picker Popover

Popovers