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_orderComponent contract
The renderer receives:
taskpreviewonApplyonCancelonRefreshisApplyingisCancellingisRefreshing
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
onRefreshwhen route-changing fields update - call
onApplyonly 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.