Message Edit

View registry JSON

Edit and resend a message in place, then step between its previous versions.

Install with the shadcn CLI

npx shadcn@4.21.5 add @cavemio/message-edit
First install? Configure @cavemio once

Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.

components.json
{
  "registries": {
    "@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
  }
}

Overview

Edit and resend a message in place, then step between its previous versions.

Uses local demo data; no AI service or network requests.

import { MessageEdit } from "@/components/message-edit";

<MessageEdit text={message} onSubmit={setMessage} />

Props

PropTypeDescription
textstringRequired. Current message text.
onSubmit(text: string) => voidRequired. Called with the edited text; replace the message and regenerate from it.
disabledbooleanOptional. Disable editing, e.g. while an answer streams.
disabledReasonstringOptional. Explanation shown when editing is unavailable.
versions{ index: number; count: number; onIndexChange: (index: number) => void; }Optional. Branches of this message, shown as "2 / 3".
childrenReact.ReactNodeOptional. How the sent message renders; defaults to the text.