Skip to main content

File Structure

When you install threaded comments, approximately 25 TypeScript/TSX files are copied into your project in a clear, navigable structure.

Directory Tree


Key Files

index.ts — Entry Point

Barrel export for clean imports:
This lets you write:

threaded-comment-section.tsx — Main Component

The entry component that orchestrates everything. Edit this to:
  • Add custom headers or footers
  • Modify the overall layout
  • Change the component structure

new-comment-form.tsx — Comment Input

The textarea and submit button for top-level comments. Edit this to:
  • Customize placeholder text
  • Change button styles
  • Add character counters

single-comment.tsx — Individual Comment

The core comment display component. Edit this to:
  • Change author name styling
  • Modify comment body layout
  • Add custom badges or labels

vote-buttons.tsx — Voting UI

Upvote and downvote buttons with score display. Edit this to:
  • Change button colors
  • Modify vote count formatting
  • Change icon styles

use-threaded-comments.tsx — Main Hook

Contains all comment data logic and callbacks. This is where you customize behavior like:
  • loginRequiredCallback — Called when an unauthenticated user tries to comment
  • usernameRequiredCallback — Called when a user without a username tries to comment
  • otherUserClickCallback — Called when a user clicks on another user’s name/avatar

Common Customizations

Change Colors

Inline Styles Variant: Look for the color palette guide at the top of component files:
Find and replace hex codes throughout the file. Tailwind Variant: Change utility classes directly:

Modify Layout

Open threaded-comment-section.tsx and rearrange JSX:

Remove Features

Don’t want vote buttons? Remove them from single-comment.tsx:

File Responsibilities


Next Steps

Props & API

Component props reference

Customization

Customize colors, layout, functionality

Features

Explore all features

Installation

Installation guide