Installing Threaded Comments
Add Reddit-style threaded comments to your project with a single command.Prerequisites
1
Initialize CLI
sublay.json configuration file.2
Install the Sublay SDK
React (Web):React Native:Expo:The component’s other packages are listed under Required Dependencies.
add offers to install any that are missing.Installation Command
--ref v8 reads the component from the v8 branch of the registry, where the v8 components live.
What Gets Installed
The CLI will:- Fetch the component from the registry based on your
sublay.jsonplatform and style settings - Copy the component’s files (42 on React, 43 with Tailwind, 47 on React Native and Expo) into your project at
{componentsPath}/comments-threaded/: the component’s own files, and the shared pieces it is built from inshared/. Every file is yours to edit, the shared pieces included. - Transform imports to work with your project structure
- Create
index.tsbarrel export for clean imports - Display usage examples and required dependencies
File Structure Created
- React (Web)
- React Native / Expo
Using the Component
After installation, import and use the component:- React (Web)
- React Native / Expo
entityId (or pass the entity object). For a record in your own database, pass its ID as foreignId with createIfNotFound instead; see Attach comments to records you already have.
Make sure your app is wrapped with
<SublayProvider>. See the Quick Start Guide for setup details.On React Native and Expo, the sheets (the comment menu, Report, Sort) also need your whole app wrapped in
<GestureHandlerRootView style={{ flex: 1 }}> from react-native-gesture-handler. Without it they don’t open or drag. react-native-reanimated needs its Babel setup too: Expo’s preset does it for you; on React Native, follow Reanimated’s install steps.The Tailwind variant on React Native and Expo needs NativeWind set up in your app, or the components render unstyled. See Tailwind on React Native and Expo.
Switching Styling Variants
To switch between Tailwind and Inline Styles after installation:1
Delete Current Components
2
Update Configuration
Edit
sublay.json:3
Re-install
Troubleshooting
Import errors
Import errors
Make sure your import path matches your
paths.components in sublay.json:Error: must be rendered inside ThreadedComments (React Native / Expo)
Error: must be rendered inside ThreadedComments (React Native / Expo)
ThreadedCommentSection and ThreadedCommentInput share state that ThreadedComments holds, so they throw ThreadedCommentSection must be rendered inside <ThreadedComments>. (or the same for ThreadedCommentInput) when they are rendered outside it. Wrap the screen that renders them in <ThreadedComments>.TypeScript errors
TypeScript errors
Ensure your
tsconfig.json includes the components directory:Component already exists
Component already exists
Re-running Because these files are yours to edit, any customizations you made are
replaced. Commit (or back up) your changes before re-adding a component:
add overwrites the existing installation. The CLI prints a
warning first, then proceeds:Next Steps
Props & API
Learn about available props
File Structure
Understand the component organization
Customization
Customize colors, layout, and functionality
Features
Explore all features

