Skip to main content

Quick Start Guide

This guide will have you up and running with Sublay comment components in under 5 minutes.

Before You Begin

  • ✅ Node.js 18+ installed
  • ✅ A React, React Native, or Expo project
  • ✅ A Sublay project created

Step 1: Initialize the CLI

Run the init command in your project directory:

Answer the prompts:

1

Select Platform

2

Choose Styling

  • Select Tailwind CSS if you use Tailwind
  • Select Inline Styles otherwise
3

Set Component Path

Press Enter to use the default, or type a custom path.
The CLI creates a sublay.json configuration file and checks for required dependencies.

Step 2: Install Dependencies (if needed)

The CLI will prompt you to install these automatically if they’re missing.

Step 3: Add a Component

Reddit-style discussions with unlimited nesting, upvote/downvote, threading lines, and collapsible threads.
The CLI copies ~25 source files into your project and shows a usage example.

Step 4: Set Up SublayProvider

Wrap your app (or the relevant section) with SublayProvider:
For authentication setup and obtaining signedToken, see the Authentication guide.

Step 5: Use the Component

That’s it! You now have a fully functional comment system.

Complete Example


What Gets Installed

All files are editable TypeScript/TSX, documented with inline comments, and committed to your repo.

Troubleshooting

Make sure the import path matches your paths.components in sublay.json:
  1. Check that <SublayProvider> wraps the component
  2. Verify projectId and signedToken are correctly set
  3. Check the browser console for errors
Ensure your tsconfig.json includes the components directory:
Set darkMode: 'class' in tailwind.config.js and add a dark class to a parent element:

Next Steps

Props API

Learn about available props and options

File Structure

Understand the installed file organization

Customization

Customize colors, layout, and functionality

Styling Variants

Inline styles vs Tailwind CSS