Skip to documentation content

Plan

Show the plan an agent proposes before it acts, stream its steps in, and let the person approve or revise it.

plan-demo

Overview

Plan shows what an agent intends to do before it does it: a title, a short summary, and the steps in order. The person approves it or asks for a revision.

It shows the plan and status you pass. Once the plan runs, track the work with Task Rows.

Anatomy

Plan
  • HeaderThe title, the step count or status, and the disclosure
  • SummaryWhat the plan sets out to do
  • StepsNumbered steps, each with an optional detail
  • ActionsRevise and Approve, while the plan is proposed

Installing plan brings Button, Collapsible, and Text Shimmer along as registry dependencies.

Behavior

Status

StatusHeaderActions
streaming"Planning", with a placeholder under the last stepHidden
proposedThe step countRevise and Approve
approved"Approved"Hidden
revising"Revising"Hidden

Streaming

Append steps to the array as they arrive and keep status at streaming. Steps present on the first render appear at once; later ones fade in. Set status to proposed when the plan is complete.

Collapsing

The header opens and closes the steps. It starts open; pass defaultOpen={false}, or control it with open and onOpenChange, to collapse a decided plan.

Approve and Revise

Each button appears only when you pass its handler. Changing status after the person answers is your application's work.

Accessibility

The plan is a region named by its title. The header is a button that reports whether the steps are expanded. The steps are an ordered list, and each one is read with its number, such as "Step 2: Find the rows that broke the schema". While streaming the region is marked busy, and a status message announces when the plan is ready and when it is decided. With reduced motion, new steps appear without fading.

KeyAction
TabMove to the header and the actions
Enter or SpaceOpen or close the steps, or press the focused action

Installation

npx honestui@latest add plan

Usage

import { Plan } from "@/components/ai/plan"

<Plan
  title={plan.title}
  summary={plan.summary}
  steps={plan.steps}
  status={plan.isStreaming ? "streaming" : plan.decision ?? "proposed"}
  onApprove={() => agent.approvePlan(plan.id)}
  onRevise={() => composer.focus()}
/>

Examples

Streaming

Steps arrive one by one, then the actions appear.

plan-streaming

API reference

Plan

Accepts native section props beyond those listed.

PropTypeDefaultDescription
titleReactNodeRequiredWhat the plan is for.
summaryReactNodeNoneA sentence or two on the approach.
stepsPlanStep[]RequiredThe steps, in order.
statusPlanStatus"proposed"Where the plan stands.
onApprove() => voidNonePassing it shows Approve while proposed.
onRevise() => voidNonePassing it shows Revise while proposed.
defaultOpenbooleantrueWhether the steps start open.
openbooleanNoneControls whether the steps are open.
onOpenChange(open: boolean) => voidNoneCalled when the header is pressed.
labelsPartial<PlanLabels>EnglishThe action names, status words, step count, and step prefix.

Types

ExportShape
PlanStepid, title, and an optional detail
PlanStatus"streaming", "proposed", "approved", or "revising"