nextui.dev
Home
Docs
Saved
Pricing
Components37
  • Forms & inputs7
  • Cards13
  • Buttons, badges & avatars8
  • Feedback & display6
  • Effects3
Agents23
  • Chat inputNew
  • Task checklistNew
  • ReasoningNew
  • Tool callNew
  • Model pickerNew
  • Tool approvalNew
  • AttachmentsNew
  • SourcesNew
  • Agent timelineNew
  • Context meterNew
  • Artifact panelNew
  • Message actionsNew
  • Streaming messageNew
  • Sub-agentsNew
  • Conversation shellNew
  • Agent questionNew
  • Voice agentNew
  • Voice orbNew
  • Thinking ring
  • Thinking waveNew
  • Thinking sparkle
  • Thinking bot
  • Prompt deckNew
Blocks20
  • Agent chatNew
  • Pill heroNew
  • Grid hero
  • Moodboard generatorNew
  • Waitlist heroNew
  • Intro bannerNew
  • Creative home heroNew
  • Chat heroNew
  • App shelfNew
  • Usage card
  • Design resultsNew
  • Pricing tiers
  • Dashboard home
  • The shiftNew
  • Launch perksNew
  • Testimonials
  • Quote
  • Team
  • Leads tableNew
  • Sign in
Pages13
  • ASCII workspace$49
  • Research agent$49
  • Support agent$49
  • Coding agent$49
  • CRM overviewNew
  • Marketing dashboardNew
  • Developer portfolio$49
  • Particle landing$49
  • Particle story$49
  • Statement converter$49
  • AI photo studio$49
  • Group card launch$49
  • Month-end storyNew
Themes9
  • Default
  • Ember
  • Ocean
  • Forest
  • Grape
  • Rose
  • Amber
  • Clay
  • Brutal
Upgrade
nextui.dev

nextui components, blocks and themes you install with one command.

Product

  • Components
  • Blocks
  • Themes
  • Pricing

Resources

  • Docs
  • Roadmap
  • GitHub

Legal

  • License
  • Privacy
  • Terms
  • Refunds

nextUI

[ 200 OK ] · nextUI

© 2026 NEXTUI • All rights reserved.

Upgrade
ComponentsAI & agentsMessage actions
Copy promptCopy prompt

Customize

Spins the icon and dims the message while a new answer streams

Keep the row visible instead of revealing it on hover and focus

Loop a scripted copy, thumbs down with a reason and regenerate, for demos

JSX · copied with Copy prompt

<MessageActions autoPlay text="Revenue grew 18% in Q3." />

Message actionsNew

The row under an assistant message: copy, regenerate, thumbs up or down with a reason, and a switcher between regenerated answers.

Installation

Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.

$pnpm dlx shadcn@latest add @nextui/message-actions
1{
2 "registries": {
3 "@nextui": {
4 "url": "https://nextui.dev/r/{name}.json",
5 "headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }
6 }
7 }
8}

Usage

1"use client";
2
3import { useChat } from "@ai-sdk/react";
4import { MessageActions } from "@/components/nextui/message-actions";
5
6export function Messages() {
7 const { messages, regenerate, status } = useChat();
8
9 return messages.map((message, i) => {
10 const text = message.parts.map((p) => (p.type === "text" ? p.text : "")).join("");
11 if (message.role !== "assistant") return <p key={message.id}>{text}</p>;
12 const last = i === messages.length - 1;
13
14 return (
15 <MessageActions
16 key={message.id}
17 text={text}
18 // AI SDK regenerate() replaces the last assistant message.
19 onRegenerate={last ? () => regenerate() : undefined}
20 regenerating={last && status === "streaming"}
21 onFeedback={(feedback, reason) =>
22 fetch("/api/feedback", { method: "POST", body: JSON.stringify({ id: message.id, feedback, reason }) })
23 }
24 >
25 <p>{text}</p>
26 </MessageActions>
27 );
28 });
29}

API reference

Edit props live in the preview above, or see all 14 props
PropTypeDefaultDescription
childrenReactNode | (version: number) => ReactNode–The message. Hovering or focusing it reveals the actions. A function gets the version shown
textstring–What Copy puts on the clipboard
onCopy() => void–Called after copying
onRegenerate() => void–Shows Regenerate. Usually only on the last assistant message
regeneratingbooleanfalseSpins the icon and dims the message while a new answer streams
feedback"up" | "down" | null–Controlled rating
onFeedback(feedback, reason?) => void–Called on each thumb, and again with the reason picked after thumbs down
reasonsstring[]["Not accurate", "Not helpful", "Too long", "Didn't follow instructions"]Reasons offered after thumbs down. Pass [] to skip
versionCountnumber–Answers kept for this turn. Above 1 shows a ‹ 2/3 › switcher
versionnumber–Controlled version, from 1
onVersionChange(version: number) => void–Called by the switcher
alwaysVisiblebooleanfalseKeep the row visible instead of revealing it on hover and focus
autoPlaybooleanfalseLoop a scripted copy, thumbs down with a reason and regenerate, for demos
classNamestring–Extra classes on the wrapper

Related

All components

Chat inputNew

Task checklistNew

Free

ReasoningNew

Sign in to see the code

Preview it freely. A free account copies code and prompts a few times a day.

Sign in