Skip to content
Sign upPro
FramesControl glowMenu

Control glow

The edge a browser draws around a page while an agent drives it, with a badge and a Stop button. It holds still while the agent waits for you and drains away when you take over.

The agent fills the delivery details with the edge on, stops before paying and waits, then the person takes over and the edge drains away. Loops; use Stop or Resume to take over.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/control-glow.json

Usage

tsx
import { ControlGlow } from "@/components/ui/chatcn/control-glow"

<ControlGlow
  state={driver}
  name="Agent"
  onStop={() => setDriver("user")}
  onResume={() => setDriver("agent")}
>
  <Page />
</ControlGlow>

Wrap whatever the agent is using. The edge is a 3 px line in --chatcn-primary (or tone) with a soft inner falloff, drawn on an overlay that ignores the pointer, so the page keeps working under it. It follows the corners of the box it wraps (border-radius: inherit); where the wrapper sits inside a parent without a radius, pass radius to match the screen, as on a phone screen with radius={48}.

  • agent: the edge breathes slowly (55% to 100% over 2.4 s) and the badge shows the kit spinner, "Agent is in control" and Stop.
  • paused: the edge eases to 60% and holds. The badge says "Waiting for you" with Resume.
  • user: the edge drains from the top down in 300 ms and the badge says "You have control" for noticeDuration, then leaves.
  • off: no edge and no badge.

The badge is one pill that reshapes to each message with clip-path, so nothing around it moves, and it sits below --chatcn-safe-top on a phone screen. It is a polite status region and its buttons are real buttons with 32 px hit areas (44 px on touch). A breath that resumes picks up from the opacity the edge already has, and the breath sleeps off screen. Under reduced motion the edge does not breathe and every change is a cut. In forced colors the edge becomes a 3 px Highlight outline.

Examples

States

Off, the agent in control, waiting for you and taken over, on a browser and on a phone screen.

Off, the agent in control, waiting for you and taken over, on a browser and on a phone screen.

Props

PropTypeNotes
stateoff | agent | paused | userWho drives
namestringDefault "Agent": "Agent is in control"
tonestringEdge and badge colour. Default var(--chatcn-primary)
radiusnumber | stringDefault inherit
badgebooleanDefault true
noticeDurationnumberms the takeover notice stays. Default 1600
onStop, onResume() => voidThe badge buttons show when given