# Nested Comments ## Example ```svelte {#if loading}
Loading thread...
{:else} {#if rootPost} {/if} {#if comments.length > 0}
Sort by: {#each sortOptions as option} {/each}
({ reply: { count: comment.replyCount, href: comment.href }, like: { count: comment.likeCount, href: comment.href } })} /> {:else}
No replies yet.
{/if} {/if}
``` ## Documentation ## Usage ```svelte ``` ## Features - Collapsible threads — click the left border or avatar to collapse/expand - Recursive nesting up to 5 levels deep - Relative timestamps - Reply and like counts - Supports embeds (images, videos, links) on each comment ## API Reference ### NestedComments Reddit-style threaded comments with collapsible replies. Uses the Post component internally for each comment. | Prop | Type | Default | Description | |------|------|---------|-------------| | comments | `PostData[]` | `-` | Array of top-level comments. Each comment can have nested replies via the replies field. (required) | | actions | `ActionButtonsProps | ((comment: PostData) => ActionButtonsProps)` | `-` | Action buttons config. Pass an object for the same buttons on every comment, or a function to customize per comment. | | showSensitive | `boolean` | `true` | Whether to show the sensitive content overlay on flagged embeds. | | extraEmbeds | `Snippet<[PostData]>` | `-` | Snippet for rendering custom embeds per comment. Receives the comment data as argument. | | onclickhandle | `(handle: string, href?: string) => void` | `-` | Callback when a user handle is clicked. If not set, handles render as links. | | target | `string` | `'_blank'` | The target attribute for all links. | | maxDepth | `number` | `4` | Maximum nesting depth for replies. | | logo | `Snippet` | `-` | Logo snippet shown in the post header. |