Skip to main content

Social Comments File Structure

Approximately 23 files organized for simplicity and clarity.

Directory Tree


Key Files

social-comment-section.tsx β€” Main Component

The entry component. Edit this to modify the overall layout, add headers or footers, or change how the component is structured.

new-comment-form.tsx β€” Comment Input

Handles both top-level comment input and reply input (reused for both). Edit to:
  • Customize placeholder text
  • Change submit button styles
  • Add character limits

heart-button.tsx β€” Like Button

The heart icon and like count. Edit to:
  • Change the heart icon color or style
  • Modify the like count display
  • Add animations on like

sort-by-button.tsx β€” Sort Control

The Top/New/Old sort switcher. Edit to:
  • Rename sort options
  • Remove sort options you don’t need
  • Change button styles

use-social-comments.tsx β€” Main Hook

Contains all comment logic and the key behavioral callbacks you’ll want to customize:
  • loginRequiredCallback β€” Called when an unauthenticated user tries to comment
  • usernameRequiredCallback β€” Called when a user without a username tries to comment
  • currentUserClickCallback β€” Called when a user clicks their own profile
  • otherUserClickCallback(userId, foreignId) β€” Called when a user clicks another user’s profile

Key Differences from Threaded Comments


Common Customizations

Change Heart Color

Modify Sort Options

Customize Empty State


Next Steps

Features

Feature overview

Customization

Customize colors, layout, and functionality

Props & API

Props reference

Installation

Installation guide