页面简介
A short prompt you can send to the agent in one click.
正文摘录
SectionsIntroductionComponentsAI ElementsInstallationThemingCLITypesetSkillsRegistryChangelogComponentsAccordionAlertAlert DialogAspect RatioAttachmentAvatarBadgeBreadcrumbBubbleButtonButton GroupCalendarCardCarouselChartCheckboxCode BlockCollapsibleComboboxCommandContext MenuData TableDate PickerDialogDirectionDrawerDropdown MenuEmptyFieldHover CardInputInput GroupInput OTPItemKbdLabelMarkerMessageMessage ScrollerNative SelectPaginationPopoverProgressQuestionnaireRadio 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.jsonSuggestionCopy PagePreviousNextA short prompt you can send to the agent in one click.Base UIReact AriaRadix UIAdd a dark mode toggleFix the failing buildWrite tests for the formUpgrade to Next.js 16Add a loading stateFind unused dependenciesCopy"use client" import * as React from "react"View Code Suggestion is a prompt you send without typing. Each one is a Button with the prompt as its label. Put a row of them above the Prompt Input. Installation Suggestion is built with the Button component. CommandManualpnpmnpmyarnbunpnpm dlx shadcn@latest add buttonCopy Usage Copyimport { Button } from "@/components/ui/button" Copy<div className="scrollbar-none flex scroll-fade-x gap-2 overflow-x-auto overscroll-x-contain"> {suggestions.map((suggestion) => ( <Button key={suggestion} variant="outline" size="sm" className="shrink-0" onPress={() => send(suggestion)} > {suggestion} </Button> ))} </div> Scrolling The row scrolls sideways when the suggestions do not fit. scroll-fade-x fades the edge that has more to show, and shrink-0 keeps each label on one line. AI SDK The label is the message. Send it as is. CopysendMessage({ text: suggestion }) Migrating from AI SDK Elements If you added Suggestion from AI SDK Elements, your project has a components/ai-elements/suggestion.tsx wrapper. Paste this prompt into your coding agent to rebuild it on Button. Every export keeps its name and props, so the code that uses it keeps working. PromptCopyMigrate components/ai-elements/suggestion.tsx from AI SDK Elements to the shadcn/ui Button 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 Button: npx shadcn@latest add button 2. Read https://ui.shadcn.com/docs/ai-elements/aria/suggestion.md and build Suggestion the same way. 3. Rebuild each part: - Suggestions renders a div with className="flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain", instead of a ScrollArea. Change SuggestionsProps to ComponentProps<"div">. - Suggestion renders a Button with variant="outline", size="sm" and className="shrink-0". Keep onClick, called with the suggestion from the Button's onPress. 4. Remove the imports the file no longer uses. 5. Run the type checker and fix any errors. SubagentTask On This PageInstallationUsageScrollingAI SDKMigrating from AI SDK ElementsDeploy 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