@objectifthunes/whiteboard
WHITEBOARD SAAS

FloatingPanel

A draggable, world-space panel that lives inside WhiteboardShell. Register your tool UIs here.


PREVIEW
SOURCE
import { FloatingPanel } from '@objectifthunes/whiteboard'

<FloatingPanel
  title="Settings"
  defaultPosition={{ x: 40, y: 40 }}
  width={300}
  focusable
  focusPadding={40}
  focusMaxScale={1.5}
>
  {/* body */}
</FloatingPanel>
SOURCE
interface Props {
  title: ReactNode
  defaultPosition: { x: number; y: number }
  width?: number                                   // default 300
  trackRect?: MutableRefObject<PanelRect>          // sync the panel's live rect
  focusable?: boolean
  focusPadding?: number                            // default 40
  focusMaxScale?: number                           // default 1.5
  headerActions?: ReactNode
}
NOTES

defaultPosition is captured once. Changing the prop later does not reposition the panel. The reset button (resetWidgets) snaps each panel back to its original default, not the current prop.

Pass trackRect={ref} to keep an external ref in sync with the panel's live { x, y, width, height }. Use belowPanel(ref.current) to stack a second panel underneath.