Skip to content
Sign in
Apps SDKPiP widgetMenu

PiP widgetPro

A floating picture in picture window that stays on top while the conversation continues: drag and throw it to any corner, move it with the arrow keys, minimize it to a bar with a live summary.

ProA cooking timer floating over the conversation. Drag and throw it to a corner, or minimize it.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/pip-widget

Usage

tsx
import { PipWidget } from "@/components/ui/chatcn/pro/pip-widget"

<PipWidget
  title="Rigatoni"
  summary={timer.clock}
  safeArea={{ bottom: 88 }}
  onReturn={() => setMode("inline")}
  onClose={() => setOpen(false)}
>
  <Timer />
</PipWidget>

Drag the bar anywhere and let go: the release velocity projects where the window would coast, and it snaps to the nearest corner. Corners are logical, so bottom-end stays at the reading end in RTL. Pass the composer height as safeArea.bottom so the window never covers it.

Minimizing hides the body with hidden instead of unmounting it, so timers, players and widget state keep running. The behavior is also available on its own as usePipWidget with PipWidgetBar, which is how WidgetDisplayModes builds its PiP mode.

Examples

Minimized, corners and RTL

ProThe minimized bar with a live summary and a window parked top start.

Props

PropTypeNotes
title, subtitle, iconReactNodeBar content
summaryReactNodeShown next to the title while minimized
corner, defaultCorner, onCornerChange"top-start" | "top-end" | "bottom-start" | "bottom-end"Default bottom-end
minimized, defaultMinimized, onMinimizedChangeboolean
onReturn() => voidBack to the conversation button, and Escape inside the window
onExpand() => voidShows a full screen button
onClose() => voidShows a close button
actionsReactNodeBar buttons, hidden while minimized
width, maxHeightnumberDefault 360 and 420
strategy, margin, safeAreaPositioning. Default fixed, 16 px
animateIn, minimizablebooleanDefault true

Keyboard

KeyAction
Arrow keys on the gripMove to the neighbouring corner, announced politely
Enter, SpaceMinimize, restore, full screen, back or close
EscapeBack to the conversation, when onReturn is set

Accessibility

  • The window is a named region that does not take focus when it opens: the conversation continues.
  • The grip is a real button whose description says which corner the window is in and how to move it.
  • Every bar button has a label and a 44 px target on touch.

Motion

  • Dragging follows the pointer 1:1 with rubber banding past the edges. Release settles into the corner in 280 ms ease-out on transform only, critically damped.
  • It enters and minimizes by growing out of its parked corner from 0.96 in 180 ms. Arrow key moves are instant.
  • Reduced motion: no travel, at most a 150 ms fade.