Skip to main content

Threaded Comments Props

The ThreadedCommentSection component follows a minimal props philosophy. It works with just entityId and offers optional props for specific needs.

Component Import


Props Interface


Entity Identification

One of these is required to identify which entity (post, article, etc.) the comments belong to:

entity

Type: Entity | undefined | null A complete Entity object.
Use when: You already have the full entity object from useFetchEntity or similar hooks.

entityId

Type: string | undefined | null The internal Replyke ID for the entity.
Use when: You know the Replyke entity ID.

foreignId

Type: string | undefined | null Your external/custom ID for the entity.
Use when: You’re using your own IDs and haven’t fetched the Replyke entity yet.

shortId

Type: string | undefined | null A short, human-readable identifier (if you’ve set one).
Use when: You’ve created entities with custom short IDs for URLs.
You only need ONE of these props. They’re mutually compatible — use whichever fits your data model best.

Optional Props

isVisible

Type: boolean Default: true Controls whether the comment section is visible. Useful when rendering inside a drawer, modal, or conditional layout.
Why it exists: Ensures event listeners and behaviors are only active when the component is visible, improving performance.

highlightedCommentId

Type: string | undefined | null ID of a specific comment to highlight when the section loads.
Use cases:
  • Deep-linking from notifications
  • Jumping to a specific comment from a URL param
  • Drawing attention to a particular comment
What happens:
  • The component scrolls to the highlighted comment
  • The comment is visually highlighted (background color change)
  • Highlight fades after a few seconds

theme

Type: 'light' | 'dark' Default: 'light' Only for styled (inline styles) variant. Sets the color theme for the entire comment section.
Uses this prop. Component checks theme prop and conditionally renders dark or light colors:
Wire it to your app’s theme state for synchronized dark mode.

children

Type: React.ReactNode Optional React node(s) rendered within the comment feed area.
Use for: Custom messaging, banners, or UI elements within the comment section.

Complete Examples

Minimal Usage

That’s it! Works perfectly with just this.

With Dark Mode (Inline Styles)


With Highlighted Comment


Full Example with All Props


TypeScript Support

The component is fully typed. Import types if needed:

Next Steps

File Structure

Understand component organization

Features

Explore all features

Customization

Customize the component

Installation

Installation guide