AgentScreen
A fixed-ratio frame that shows what an agent is looking at.
Usage
Basic
state switches between the capture and a placeholder; cursor overlays a pointer with an action label.
Loading demo...
Best Practices
- Put a live canvas or video in the default slot; keep
srcfor static captures. - Let
labelsay whose screen it is, and the pointer'slabelsay what the agent is doing. - Between frames, set
statetoloadinginstead of leaving a stale frame up; a stale frame reads as stuck.
API Reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
src | string | - | Image source; ignored when the default slot is filled. |
alt | string | - | Accessible description of the capture; required whenever src is set. |
label | string | - | Caption under the frame; omit to render none. |
state | 'working' | 'loading' | 'working' | Shows the capture or the loading placeholder. |
cursor | AgentScreenCursor | - | Pointer overlay; omit to hide it. |
ratio | string | '2964 / 1856' | CSS aspect-ratio of the frame; defaults to the upstream capture's ratio. |
ariaLabel | string | 'Agent screen' | Accessible name of the whole region. |
loadingLabel | string | 'Waiting for the agent’s screen' | Announced while loading. |
Slots
| Name | Description |
|---|---|
default | Replaces the frame content; takes precedence over src. |
overlay | Above the content, inside the clip; dropped while loading. |
label | Replaces the caption under the frame. |
Types
AgentScreenCursor
| Field | Type | Description |
|---|---|---|
x / y | number | Percent of the frame (0–100), so the point holds at any size; out-of-range values are clamped. |
label | string | A line beside the pointer, usually the current action. |
Overview
- The component owns the frame, the pointer, and the caption; the content comes from the default slot or
src, never both. ratiofixes the proportions, not the height: the width follows the container.- When
stateisloading, or there is neither a default slot norsrc, a skeleton placeholder replaces the capture, the pointer, andoverlay. - The root is a
role="group"named byariaLabel; the placeholder is arole="status"witharia-live="polite"that announcesloadingLabel. - Under reduced motion, the placeholder stops shimmering.
Technologies
- The placeholder reuses the library's
skeleton-surfacebar, tinted to the BUI surface color. - Adapted from Beautiful UI case 21, Agent Screen (© 2026 Shane Levine, MIT).
- Source:
packages/tuffex/packages/components/src/agent-screen/.
查看源码
packages/tuffex/packages/components/src/agent-screen/index.ts