Skip to main content

Configuration File

The sublay.json file is created in your project root during initialization. It stores your preferences and is used by the CLI when adding components.

File Location


Configuration Schema


Configuration Options

platform

Type: "react" | "react-native" | "expo" Specifies your application platform. This determines which component variants are available, which peer dependencies are required, and platform-specific imports.

style

Type: "tailwind" | "styled" Determines which styling approach to use for components.
Components use Tailwind CSS utility classes.
Requires: Tailwind CSS installed in your project
Best for: Projects already using Tailwind, design systems, developers who prefer utility-first CSS
Once you’ve added components with a specific style variant, switching requires re-installing them. Change style in sublay.json, delete the installed component directory, then re-run add.

typescript

Type: boolean — Default: true (auto-detected) Indicates whether your project uses TypeScript. Automatically detected from tsconfig.json or file extensions. You rarely need to change this manually.

paths

Type: object Configures where components are installed.
Components install at:
  • src/components/comments-threaded/
  • src/components/comments-social/
Use any path relative to your project root. The CLI creates the directory if it doesn’t exist.

aliases

Type: object Path aliases used in component imports. These should match your tsconfig.json paths or bundler alias configuration.
Components will use imports like:
Aliases must match your tsconfig.json or bundler config. Mismatched aliases cause import errors.

Complete Example

A typical sublay.json for a React web app with Tailwind CSS:

Platform-Specific Notes

React (Web)

Required dependency: @sublay/react-js@^7.0.0 Available components: Threaded comments ✅, Social comments ✅, Notification control ✅

React Native

Required dependency: @sublay/react-native@^7.0.0 Available components: Threaded comments ✅, Social comments ✅

Expo

Required dependency: @sublay/expo@^7.0.0 Available components: Threaded comments ✅, Social comments ✅

Changing Configuration

Option 1 — Edit manually: Update sublay.json directly, then delete and re-add any installed components.
Option 2 — Re-initialize: Delete sublay.json and run init again.

FAQ

No, the configuration applies globally. Pick one approach for consistency.
The CLI will error when you try to add components. Run npx @sublay/cli init to recreate it.
No. sublay.json is only used by the CLI during component installation. Your application never reads this file.

Next Steps

Quick Start Guide

Add your first component

Threaded Comments

Install Reddit-style threaded comments

Social Comments

Install Instagram-style social comments

Customization Guide

Learn how to customize components