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

Provide one of these to identify which entity 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 Sublay ID for the entity.

foreignId

Type: string | undefined | null Your external/custom ID for the entity. The component will find or create the Sublay entity automatically.
Use when: You’re using your own IDs and haven’t fetched the Sublay entity yet. This is the most common option.

shortId

Type: string | undefined | null A short, human-readable identifier (if you’ve set one on the entity).
You only need ONE of these props. 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.
Ensures event listeners 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. The component scrolls to it and applies a highlight that fades after a few seconds.
Use cases: Deep-linking from notifications, jumping to a comment via URL param.

theme

Type: 'light' | 'dark' — Default: 'light' Only for the inline styles variant. Sets the color theme for the entire comment section.
Uses the theme prop to conditionally render dark or light colors:

children

Type: React.ReactNode Optional content rendered within the comment feed area.

Complete Examples

Minimal Usage


With Dark Mode (Inline Styles)


With Highlighted Comment


Full Example


Next Steps

File Structure

Understand component organization

Features

Explore all features

Customization

Customize the component

Installation

Installation guide