This documentation is deprecated. We’ve moved to a CLI-based component approach that gives you full ownership and customization of the source code. Please see the new component documentation and migration guide for the recommended approach.
Callbacks for the Comment Section
Replyke provides a robust callback system to give developers control over user interactions in the comment section. These callbacks allow you to define specific behaviors for various scenarios, enhancing the user experience and ensuring consistency with your app’s requirements. Below is the interface for available callbacks:Callback Descriptions
-
loginRequiredCallback- Purpose: Handles scenarios where an unauthenticated user attempts to interact with the comment section.
- Default Behavior: Shows a simple alert message.
- Suggested Use: Direct the user to a login or signup page to enable interaction.
-
usernameRequiredCallback- Purpose: Enforces username setup for users without a defined username.
- Default Behavior: The interaction proceeds, and a generic username (e.g.,
user-85h344) is displayed. - Suggested Use: Prompt the user to set up a username, ideally during signup or through a dedicated flow.
-
commentTooShortCallback- Purpose: Prevents submission of empty or too-short comments/replies.
- Default Behavior: Alerts the user with a simple message.
- Suggested Use: Display a friendly message explaining why the comment cannot be submitted.
-
currentUserClickCallback- Purpose: Handles clicks on the current user’s avatar, name or mention in the comment section.
- Default Behavior: No action.
- Suggested Use: Redirect the user to their profile or account settings page.
-
otherUserClickCallback- Purpose: Handles clicks on other users’ avatars, names, or mentions.
- Default Behavior: No action.
- Suggested Use: Navigate to the clicked user’s profile or show a modal with their information.
-
userCantBeMentionedCallback- Purpose: Handles cases where a user tries to mention another user who does not have a username set.
- Default Behavior: Shows a basic alert message.
- Suggested Use: You can notify the current user that mentioning of that user is not available. To avoid that, require all new users to set a unique username.

