Edit and regenerate a reply
This local example uses recorded response alternatives.
A multiline message editor that preserves failed drafts and ignores cancelled saves.
This local example uses recorded response alternatives.
npm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { ResponseEditor } from "@noorddev/vlak-react";Per-component imports are available at @noorddev/vlak-react/components/response-editor.
npx @noorddev/vlak-cli add response-editor
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.
npx shadcn add https://vlak.dev/r/response-editor.json
Installs the same source through the shadcn CLI.
import { ResponseEditor } from "@noorddev/vlak-react";
export function EditMessage({ text, onSave, onCancel }: {
text: string;
onSave: (text: string) => void | Promise<void>;
onCancel: () => void;
}) {
return <ResponseEditor text={text} onSave={onSave} onCancel={onCancel} />;
}See the integration example to compose these components with your application's model and data.
Multiline message editing with async save, cancellation, and failed-draft retention.
| Prop | Type | Default | Description |
|---|---|---|---|
textrequired | string | ||
onSaverequired | (text: string) => void | Promise<void> | ||
onCancelrequired | () => void | ||
label | string | "Edit message" | |
saveLabel | string | "Save message" | |
disabled | boolean | ||
onError | (error: unknown) => void |
Also accepts Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "onError">.
The ref reaches HTMLFormElement.
| Keys | Does |
|---|---|
| Tab | Moves through the supplied native controls in reading order |
| Enter, Space | Activates focused buttons and disclosure summaries |
| Escape | Cancels the editor and invalidates pending feedback |
The same styles are available as CSS. Native HTML provides the static presentation; React or application code supplies state updates and actions.
npm install @noorddev/vlak
import "@noorddev/vlak/css";
<form class="rs-response-editor" aria-label="Edit message"><label>Message<textarea>Review the brief</textarea></label><div class="rs-response-editor-actions"><button class="rs-btn-subtle" type="submit">Save message</button></div></form>