TransEdge

Preview Components

Render dedicated action preview UI inside the TransEdge AI prompt.

Preview components let modules render action-specific UI instead of relying on generic model text.

Use a dedicated preview component when a user needs to inspect or edit structured data before applying an AI action.

Registry key

The AI prompt looks for renderable components using this registry pattern:

ai:action-preview:{action_key}

For example, Fleet-Ops registers:

ai:action-preview:fleet-ops.create_order

Component contract

The renderer receives:

  • task
  • preview
  • onApply
  • onCancel
  • onRefresh
  • isApplying
  • isCancelling
  • isRefreshing

Example component responsibilities

For a create-order preview, the component can:

  • show a compact route map
  • display pickup and dropoff fields
  • let the user edit schedule, driver, vehicle, notes, and proof of delivery settings
  • call onRefresh when route-changing fields update
  • call onApply only when the user confirms creation
  • render completed, cancelled, and failed terminal states
<Ai::CreateOrderPreview
  @task={{@task}}
  @preview={{@preview}}
  @onRefresh={{@onRefresh}}
  @onApply={{@onApply}}
  @onCancel={{@onCancel}}
  @isApplying={{@isApplying}}
/>

Design guidance

Preview components should be compact and chat-native. Avoid full-page admin form layouts inside the AI prompt.

Use dedicated preview UI when the action needs maps, editable drafts, validation, or a clear apply/cancel workflow.

Do not reuse large page-level panels inside the prompt. Build a compact preview surface optimized for chat.

Preview Components | TransEdge