"use client" import * as React from "react" import { FloatingWindow, type FloatingWindowRect, } from "@/components/ui/floating-window" import { Button } from "@/components/ui/button" const DEMO_DEFAULT: FloatingWindowRect = { x: 40, y: 56, width: 300, height: 200, } /** * Live Floating Window inside the doc stage. * Portals into the stage (absolute, not fixed) so it stays on the catalog page. */ export function FloatingWindowLivePreview() { const hostRef = React.useRef(null) const [mounted, setMounted] = React.useState(false) const [open, setOpen] = React.useState(true) const [rect, setRect] = React.useState(DEMO_DEFAULT) React.useEffect(() => { setMounted(true) }, []) return (

Grip: arrows move · Alt+arrows resize · click snaps corner

{mounted && hostRef.current ? ( DEMO_DEFAULT} aria-label="Demo tool window" container={hostRef.current} onEscape={() => setOpen(false)} cornerSnap={false} className="!absolute z-10" title={ Demo window } >

The page behind stays live. This is a non-modal tool window.

Focus the grip to move or resize with the keyboard.

) : null}
) }