interface CommentFormProps

Passed to CommentForm by CommentThread, for a new comment, and by CommentNode, for a reply.

Properties

onSubmit: (body: string) => Promise<void>

Sends the text. The form empties itself once it resolves. When it throws, as expectOk does, the form keeps the text and shows the error under errorTitle.

submitLabel: React.ReactNode
pendingLabel: React.ReactNode
errorTitle: string
optional
placeholder: string
optional
onCancel: () => void

Without it, the form has no Cancel button.

optional
cancelWhenEmpty: boolean

Shows Cancel only once there is text to throw away, and doesn't cancel on Escape. For the new-comment form, which has nothing to close.

optional
editorRef: React.Ref<TextEditorHandle>
optional
layout: "inline" | "top"

top puts leading beside the editor, for the new-comment form. inline is for replies, inside a comment.

optional
leading: React.ReactNode
optional
className: string

Applies to the inline layout only.

Usage

import { type CommentFormProps } from "src/components/comment/CommentForm.tsx";