Skip to content
EspañolEnglish
All components (283)

Plan

AI · Plan

What it is and when to use it

The plan an agent proposes and goes on fulfilling: its steps in order, each with its state and the progress ("2 of 5") in the title.

When to use it

  • Showing what an agent is going to do or is doing, so whoever supervises it can follow it and stop it in time.
  • steps are the steps: { key, label, status?, detail? }. Without status, a step is pending. streaming tells the screen reader that the plan changes.
  • Progress counts done and skipped steps as finished.

When not to

  • Steps a person goes through in an assistant: Steps or Wizard.
  • A record of what happened, without order: ActivityLog.
  • A single tool call: ToolCall.

Keyboard: the title is the button that folds and opens: Tab, Enter or Space. There is nothing else to focus inside.

Accessibility: the state of each step is seen through the icon (tick, cross, spinning ring, empty circle, dash) and said with hidden text: colour is not the only thing that informs. The list carries a name and, while it is being written, aria-busy.

Fine-tuning: amset-plan and the amset-plan__* classes; the icons use the text tones of success, error and accent.

What it looks like

I review last month's orders and prepare a reminder for each customer with an overdue invoice.

  1. DoneRead last month's orders1.2 sec
  2. DoneGroup by customer3.4 sec312 customers
  3. In progressWork out each customer's total
  4. PendingGenerate the unpaid reminders
  5. PendingSend the emails

<Plan
  title="Warn customers with unpaid invoices"
  description="I review last month's orders and prepare a reminder for each customer with an overdue invoice."
  steps={[
    { key: "1", label: "Read last month's orders", status: "done" },
    { key: "2", label: "Group by customer", status: "done", detail: "312 customers" },
    { key: "3", label: "Work out each customer's total", status: "active" },
    { key: "4", label: "Generate the unpaid reminders", status: "pending" },
    { key: "5", label: "Send the emails", status: "pending" },
  ]}
/>

Props

Import it with import { Plan } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
stepsrequiredreadonly PlanStep[]The steps, in order: `{ key, label, status?, detail? }`. Without `status`, a step is pending.
titlerequiredstringWhat the plan is for: "Migrate the shop".
classNamestringMerged with the library classes; it does not replace them.
defaultExpandedbooleanOpen at the start. Yes by default.
descriptionstringWhat it proposes to do, in one sentence.
streamingbooleanThe plan is still being written or run: tells the screen reader that it changes.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: