翻篇收录说明
翻篇网页快照

Plan - shadcn/ui

https://ui.shadcn.com/docs/ai-elements/radix/plan

最近抓取:2026-12-04 03:58:49(北京时间)

最近内容变化:2026-12-01 01:31:18(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Displays the steps the agent plans to take, and how far it has got.

正文摘录

SectionsIntroductionComponentsAI ElementsInstallationThemingCLITypesetSkillsRegistryChangelogComponentsAccordionAlertAlert DialogAspect RatioAttachmentAvatarBadgeBreadcrumbBubbleButtonButton GroupCalendarCardCarouselChartCheckboxCode BlockCollapsibleComboboxCommandContext MenuData TableDate PickerDialogDirectionDrawerDropdown MenuEmptyFieldHover CardInputInput GroupInput OTPItemKbdLabelMarkerMenubarMessageMessage ScrollerNative SelectNavigation MenuPaginationPopoverProgressQuestionnaireRadio GroupResizableScroll AreaSelectSeparatorSheetSidebarSkeletonSliderSonnerSpinnerSwitchTableTabsTextareaToastToggleToggle GroupTooltipTraceTypographyAI ElementsIntroductionChain of ThoughtChatCheckpointConfirmationContextFile TreeInline CitationMessageModel SelectorPlanPrompt InputQueueReasoningSourcesStack TraceSubagentSuggestionTaskTerminalTest ResultsToolGet StartedInstallationcomponents.jsonPackage ImportsThemingTypesetDark ModeCLIMonorepoSkillsJavaScriptFigmallms.txtLegacy Docs@shadcn/reactMessage ScrollerQuestionnaire@shadcn/helpersAI SDKTanStack AIFormsReact Hook FormTanStack FormFormischUtilitiesscroll-fadeshimmerRegistryIntroductionGetting StartedGitHub RegistriesRegistry DirectoryRegistry HealthExamplesNamespacesAuthenticationDynamic SearchMCP ServerOpen in v0FAQAPI Referenceregistry.jsonregistry-item.jsonPlanCopy PagePreviousNextDisplays the steps the agent plans to take, and how far it has got.Base UIReact AriaRadix UIMigrate the dialog components to Base UI.Plan: migrate to Base UI4 of 4 doneInstall @base-ui/reactReplace the Radix importsRename asChild to renderRun the type checkerMigrated Dialog and AlertDialog. The type checker passes.ReplayCopy"use client" import { useChat } from "@ai-sdk/react"View Code Plan is the list of steps the agent decides on before it starts, such as the steps of a migration. Each step is done, running or pending, and the title counts how many are done. Plan is built with Trace with a TraceCollapsible for the plan. When the steps are not known up front, use Task instead. Installation Plan is built with the Trace component. CommandManualpnpmnpmyarnbunpnpm dlx shadcn@latest add traceCopy Usage Copyimport { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, } from "@/components/ui/trace" Copy<Trace> <TraceCollapsible defaultOpen> <TraceCollapsibleTrigger> <TraceLine status="running"> <TraceIcon> <RouteIcon /> </TraceIcon> <TraceTitle>Plan: migrate to Base UI</TraceTitle> <TraceDescription>2 of 5 done</TraceDescription> </TraceLine> </TraceCollapsibleTrigger> <TraceCollapsibleContent> <Trace> <TraceLine> <TraceIcon> <CircleCheckIcon /> </TraceIcon> <TraceTitle>Replace the Radix imports</TraceTitle> </TraceLine> <TraceLine status="running"> <TraceIcon> <CircleDotIcon /> </TraceIcon> <TraceTitle>Rename asChild to render</TraceTitle> </TraceLine> <TraceLine status="pending"> <TraceIcon> <CircleIcon /> </TraceIcon> <TraceTitle>Run the type checker</TraceTitle> </TraceLine> </Trace> </TraceCollapsibleContent> </TraceCollapsible> </Trace> Details Put a description above the steps, inside TraceCollapsibleContent. Plan: add dark mode1 of 4 doneStore the theme in a cookie so the server renders the right one and the page does not flash on load.Add a dark variant to the theme tokensRead the theme from a cookie on the serverAdd a toggle to the settings pageCheck contrast on the chartsCopyimport { CircleCheckIcon, CircleIcon, RouteIcon } from "lucide-react" import {View Code AI SDK Stream the plan as a data part with a fixed id. The AI SDK replaces a data part with the same id, so it updates in place. app/api/chat/route.tsCopyconst stream = createUIMessageStream({ execute: async ({ writer }) => { writer.write({ type: "data-plan", id: "plan", data: { title, steps } }) }, }) Copyconst plan = message.parts.find((part) => part.type === "data-plan") Migrating from AI SDK Elements If you added Plan from AI SDK Elements, your project has a components/ai-elements/plan.tsx wrapper. Paste this prompt into your coding agent to rebuild it on Trace. Every export keeps its name and props, so the code that uses it keeps working. PromptCopyMigrate components/ai-elements/plan.tsx from AI SDK Elements to the shadcn/ui Trace component. Keep every export, with the same name and props, so the code that imports it keeps working. Only change how each part renders. 1. Install Trace: npx shadcn@latest add trace 2. Read https://ui.shadcn.com/docs/ai-elements/radix/plan.md and build Plan the same way. 3. Rebuild each part: - Plan renders a Trace with a TraceCollapsible, instead of a Card. Pass isStreaming down in a context. - PlanHeader renders a TraceCollapsibleTrigger with a TraceLine. Set status="running" on the TraceLine while isStreaming is true, instead of the Shimmer. - PlanTitle renders a TraceTitle, and PlanDescription a TraceDescription, like "2 of 4 done". - PlanContent renders a TraceCollapsibleContent with a Trace for the steps. - PlanTrigger renders only its children, since the whole line opens the plan. - Buttons cannot sit inside a trigger. Render PlanAction next to the TraceCollapsibleTrigger, not inside it. - Keep PlanFooter as a plain container. 4. Remove the imports the file no longer uses. 5. Run the type checker and fix any errors.Expand API Reference See Trace. Model SelectorPrompt Input On This PageInstallationUsageDetailsAI SDKMigrating from AI SDK ElementsAPI ReferenceDeploy your shadcn/ui app on VercelTrusted by OpenAI, Sonos, Adobe, and more.Vercel provides tools and infrastructure to deploy apps and features at scale.Deploy NowDeploy to Vercel