Comments API
Initialization
interface CommentsConfig {
// Array of comments to be displayed
value?: Comment[];
// List of users to mention in comments
users?: User[];
// ID of the active user
activeUser?: number;
// Function to format the comment content
format?: (text: string) => string | "markdown" | "text";
// Flag to auto-focus the editor on render
focus?: boolean;
// Flag to render the widget in read-only mode
readonly?: boolean;
// Custom component or string for rendering messages
render?: string | Component;
// Callback function when comments data changes
onchange?: (change: OnChange) => void;
// Callback function to retrieve comments data
ondata?: (id: number) => Promise<Comment[]> | Comment[];
}
Comments Properties
| activeUser | Optional. Identifies the current user in the comments widget |
| focus | Optional. Controls whether the comments editor should be auto-focused after rendering |
| format | Optional. Controls how the message content is rendered in the comments widget |
| readonly | Optional. Controls whether the comments widget is in read-only mode |
| render | Optional. Controls how messages are displayed in the widget |
| users | Optional. Provides a list of users that can be associated with comments |
| value | Optional. Provides a list of users that can be referenced in the comments widget |
Comments Events
| change | Fires when comments data has been changed |
| data | The event is triggered to fetch comments data |
Related resources
- Visit the Features Guide to learn more about the widget's functionality.
- Explore the samples to visualize the available features.