Documentation

Strata Docs

Everything you need to install, configure, and sync your design system in minutes.

Install the SDK

npm install @strata-ds/core

Or with yarn: yarn add @strata-ds/core

Quick start

01

Create a project

Go to strata.charisol.io, create a project, and import your design tokens from a Style Dictionary JSON or Figma file.

02

Get your project ID & token

Open the Publish & Sync tab on your project dashboard. Copy your project ID and generate a sync token.

03

Install the package

Run npm install @strata-ds/core. Works with React 18+, Next.js App Router, and Pages Router.

04

Wrap and use

Add StrataProvider at your app root, pass projectId, snapshotCdnBase, and syncToken, then call useComponents() anywhere inside.

Installation

npm install @strata-ds/core
# or
yarn add @strata-ds/core

StrataProvider setup

Wrap your root layout with StrataProvider. Pass your projectId, snapshotCdnBase, and syncToken for CDN-first sync. StrataProvider polls every syncInterval milliseconds (default 3000) and updates all consuming components without a page reload.

syncEnabledbooleandefault: false

Enable live polling from the Strata backend.

syncUrlstring

Legacy — base URL from your project dashboard. StrataProvider appends /variables, /components, and /custom. Prefer snapshotCdnBase + projectId instead.

syncIntervalnumberdefault: 3000

Polling interval in milliseconds.

projectIdstring

Your Strata project ID. Required when using snapshotCdnBase.

snapshotCdnBasestring

CDN base URL for snapshot fetches. When set with projectId, a single edge-cached request replaces 3 Lambda calls.

syncTokenstring

Sync token from the Publish & Sync tab. Adds Authorization: Bearer to all sync requests.

💡 Get your projectId and generate a syncToken from the Publish & Sync tab on your project dashboard at strata.charisol.io.
// app/layout.tsx  (Next.js App Router)
import { StrataProvider } from "@strata-ds/core";

export default function RootLayout({ children }) {
  return (
    <StrataProvider
      syncEnabled={true}
      projectId="YOUR_PROJECT_ID"
      snapshotCdnBase="https://cdn.strata.charisol.io"
      syncToken="pt_live_your_token_here"
    >
      {children}
    </StrataProvider>
  );
}

Using components with useComponents()

useComponents() returns a map of every component you defined in your Strata project, keyed by PascalCase name. Render them conditionally — they are undefined while the first sync is in flight.

"use client";
import { useComponents } from "@strata-ds/core";

function App() {
  const { Button, Navbar, Card } = useComponents();

  return (
    <>
      {Button && <Button onClick={() => console.log("clicked")}>Click me</Button>}
      {Card && <Card style={{ padding: "20px" }}>Card content</Card>}
    </>
  );
}

Web Components integration

If your app is not React-based, use the Web Components package. Register the elements once at startup, then use custom elements directly in HTML templates.

npm install @strata-ds/web-components
import { registerStrataElements, initStrataSync } from "@strata-ds/web-components";

registerStrataElements();

initStrataSync({
  projectId: "YOUR_PROJECT_ID",
  snapshotCdnBase: "https://cdn.strata.charisol.io",
  syncToken: "pt_live_your_token_here",
  syncEnabled: true,
  syncInterval: 3000,
});
<!-- Example usage -->
<strata-button variant="primary">Save changes</strata-button>
<strata-card elevation="sm">
  <h3>Design token preview</h3>
</strata-card>

The same sync settings apply across React and Web Components: syncEnabled, syncInterval, projectId, snapshotCdnBase, and syncToken.

Build-time vs runtime

Build-time sync

Compile tokens and components at deploy time. Ideal when release governance is strict.

Runtime sync

Poll every 3 seconds and apply updates live, including structural component changes.

Hooks reference

useComponents()

Record<string, React.ComponentType>

Map of all registered PascalCase components.

useComponent(name)

React.ComponentType | null

Single component by name.

useStrata()

StrataContextType

Full context: designSystem, syncStatus, lastSynced, forceSync, syncUrl, syncEnabled.

useDynamicComponents()

ComponentRegistry

Raw registry map before PascalCase normalisation.

TypeScript types

The Strata SDK is fully typed. All hooks and components export TypeScript definitions for complete IDE autocomplete and type safety.

DesignToken interface

interface DesignToken {
  name: string;            // e.g. "--color-brand-primary"
  value: string | number;  // e.g. "#3B82F6" or 16
  type: 'color' | 'spacing' | 'fontSize' | 'fontWeight' |
        'lineHeight' | 'shadow' | 'borderRadius' | 'other';
  unit?: string;           // e.g. "px", "rem", "%"
  comment?: string;        // Designer notes
  category?: string;       // Grouping (e.g. "brand", "semantic")
}

ComponentNode interface

interface ComponentNode {
  id: string;
  name: string;
  type: 'button' | 'input' | 'card' | 'nav' | 'other';
  properties: Record<string, string | number>;
  styles?: Record<string, string>;
  children?: ComponentNode[];
}

Hook return types

import { useVariables, useComponents } from '@strata-ds/core';

// useVariables() returns a typed token map
const variables: Record<string, DesignToken> = useVariables();

// useComponents() returns a typed component tree
const components: ComponentNode[] = useComponents();

// Full IDE autocomplete
const primaryColor = variables['--color-brand-primary'].value;
//    ^? string | number

// Type-safe component access
const button = components.find(c => c.type === 'button');
//    ^? ComponentNode | undefined
💡 Install the SDK to get instant type definitions in your IDE: npm install @strata-ds/core

Debugging

Drop <StrataDebug /> anywhere inside StrataProvider during development. It renders a panel showing sync status, last synced timestamp, the sync URL, and all registered component names.

import { StrataDebug } from "@strata-ds/core";

// Anywhere inside <StrataProvider>
<StrataDebug />

Ready to ship your first live update?

© 2025 Charisol. All rights reserved.