Components/AgentScreen

AgentScreen

A fixed-ratio frame that shows what an agent is looking at.

VerifiedSince 0.6.0

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 src for static captures.
  • Let label say whose screen it is, and the pointer's label say what the agent is doing.
  • Between frames, set state to loading instead of leaving a stale frame up; a stale frame reads as stuck.

API Reference

Props

NameTypeDefaultDescription
srcstring-Image source; ignored when the default slot is filled.
altstring-Accessible description of the capture; required whenever src is set.
labelstring-Caption under the frame; omit to render none.
state'working' | 'loading''working'Shows the capture or the loading placeholder.
cursorAgentScreenCursor-Pointer overlay; omit to hide it.
ratiostring'2964 / 1856'CSS aspect-ratio of the frame; defaults to the upstream capture's ratio.
ariaLabelstring'Agent screen'Accessible name of the whole region.
loadingLabelstring'Waiting for the agent’s screen'Announced while loading.

Slots

NameDescription
defaultReplaces the frame content; takes precedence over src.
overlayAbove the content, inside the clip; dropped while loading.
labelReplaces the caption under the frame.

Types

AgentScreenCursor

FieldTypeDescription
x / ynumberPercent of the frame (0–100), so the point holds at any size; out-of-range values are clamped.
labelstringA 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.
  • ratio fixes the proportions, not the height: the width follows the container.
  • When state is loading, or there is neither a default slot nor src, a skeleton placeholder replaces the capture, the pointer, and overlay.
  • The root is a role="group" named by ariaLabel; the placeholder is a role="status" with aria-live="polite" that announces loadingLabel.
  • Under reduced motion, the placeholder stops shimmering.

Technologies

  • The placeholder reuses the library's skeleton-surface bar, 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