TidalUI

Comments thread preview

Discuss one record with controlled replies, edits, deletion requests and resolved state.

pro · Blocks · composite

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add @tidal-pro/comments-thread

Import components/ui/tidal.css, components/ui/comments-thread.css. Wrap installed components in tidal-scope.

Preview

Comments thread component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/comments-thread.css";
import{TidalCommentsThread}from"./components/ui/comments-thread";
export default()=><div className="tidal-scope"><TidalCommentsThread comments={[{id:"example",author:"value",content:"value"}]} draft={"value"} onDraftChange={() => {}} resolved={false} title={"Demo"}/></div>;

API and props

TidalCommentsThread.comments (required)
ReadonlyArray<TidalThreadComment>

Required comments value accepted by this exported component.

TidalCommentsThread.draft (required)
string

Required draft value accepted by this exported component.

TidalCommentsThread.onDraftChange (required)
(value: string, event: ChangeEvent<HTMLTextAreaElement>) => void

Callback invoked when the draft change interaction is proposed.

TidalCommentsThread.resolved (required)
boolean

Required resolved value accepted by this exported component.

TidalCommentsThread.title (required)
ReactNode

Required title value accepted by this exported component.

TidalCommentsThread.cancelButtonProps
NativeButtonProps | undefined

Optional cancel button props value accepted by this exported component.

TidalCommentsThread.cancelButtonRef
Ref<HTMLButtonElement> | undefined

Optional cancel button ref value accepted by this exported component.

TidalCommentsThread.composerAttachments
ReactNode

Optional composer attachments value accepted by this exported component.

TidalCommentsThread.composerContext
TidalCommentComposerContext | undefined

Optional composer context value accepted by this exported component.

TidalCommentsThread.composerError
ReactNode

Optional composer error value accepted by this exported component.

TidalCommentsThread.composerHint
ReactNode

Optional composer hint value accepted by this exported component.

TidalCommentsThread.description
ReactNode

Optional description value accepted by this exported component.

TidalCommentsThread.emptyContent
ReactNode

Optional empty content value accepted by this exported component.

TidalCommentsThread.formProps
(Omit<Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref">, "aria-disabled" | "children" | "dangerouslySetInnerHTML" | "onSubmit"> & { onSubmit?: (event: FormEvent<HTMLFormElement>) => void; }) | undefined

Optional form props value accepted by this exported component.

TidalCommentsThread.formRef
Ref<HTMLFormElement> | undefined

Optional form ref value accepted by this exported component.

TidalCommentsThread.headingLevel
"h2" | "h3" | "h4" | "h5" | "h6" | undefined

Optional heading level value accepted by this exported component.

TidalCommentsThread.labels
Partial<{ open: string; resolved: string; resolve: string; reopen: string; reply: string; edit: string; delete: string; comment: string; replyComposer: string; editComposer: string; submit: string; replySubmit: string; saveChanges: string; saving: string; cancel: string; actions: string; }> | undefined

Optional labels value accepted by this exported component.

TidalCommentsThread.onCancelComposer
((event: MouseEvent<HTMLButtonElement>) => void) | undefined

Callback invoked when the cancel composer interaction is proposed.

TidalCommentsThread.onDeleteRequest
((comment: TidalThreadComment, event: MouseEvent<HTMLButtonElement>) => void) | undefined

Callback invoked when the delete request interaction is proposed.

TidalCommentsThread.onEditRequest
((comment: TidalThreadComment, event: MouseEvent<HTMLButtonElement>) => void) | undefined

Callback invoked when the edit request interaction is proposed.

TidalCommentsThread.onReplyRequest
((comment: TidalThreadComment, event: MouseEvent<HTMLButtonElement>) => void) | undefined

Callback invoked when the reply request interaction is proposed.

TidalCommentsThread.onResolvedChange
((resolved: boolean, event: MouseEvent<HTMLButtonElement>) => void) | undefined

Callback invoked when the resolved change interaction is proposed.

TidalCommentsThread.onSubmitComment
((value: string, event: FormEvent<HTMLFormElement>) => void) | undefined

Callback invoked when the submit comment interaction is proposed.

TidalCommentsThread.pending
boolean | undefined

Optional pending value accepted by this exported component.

TidalCommentsThread.resolveButtonProps
Omit<NativeButtonProps, "aria-pressed"> | undefined

Optional resolve button props value accepted by this exported component.

TidalCommentsThread.resolveButtonRef
Ref<HTMLButtonElement> | undefined

Optional resolve button ref value accepted by this exported component.

TidalCommentsThread.submitButtonProps
NativeButtonProps | undefined

Optional submit button props value accepted by this exported component.

TidalCommentsThread.submitButtonRef
Ref<HTMLButtonElement> | undefined

Optional submit button ref value accepted by this exported component.

TidalCommentsThread.textareaProps
Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "defaultValue" | "id" | "aria-disabled" | "children" | "dangerouslySetInnerHTML"> | undefined

Optional textarea props value accepted by this exported component.

TidalCommentsThread.textareaRef
Ref<HTMLTextAreaElement> | undefined

Optional textarea ref value accepted by this exported component.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas