SSyncropel Docs

React Components

A fixed set of 21 React components that render Syncropel projection documents, themed with CSS variables and needing no provider.

What this is

@syncropel/react ships 21 React components (17 basic components and 4 combined ones), designed to render SRP projection documents and to build small interfaces for Syncropel workspaces. The set is intentionally fixed, so a Syncropel interface looks the same everywhere.

Key properties:

  • No provider: no <ThemeProvider> wrapper. Styles use CSS variables at :root
  • Fixed set: layout, content, interactive and state components, plus 4 combined ones
  • Fixed shape, customizable look: component shapes don't change; colors, spacing and type sizes do, through CSS
  • Works with projections: prop types match the SRP types from @syncropel/projections
  • Client components: interactive components are marked "use client", so they are safe to use in React Server Components

Install

npm install @syncropel/react @syncropel/projections

Requires React 18+ and React DOM 18+ (peer dependencies).

Wire up the styles

Import the compiled CSS once at your app root, usually app/layout.tsx (Next.js), main.tsx (Vite), or _app.tsx (pages router):

import "@syncropel/react/styles.css";

Optionally import the token sheet separately if you want to override tokens in isolation:

import "@syncropel/react/tokens.css";

Hello component

import "@syncropel/react/styles.css";
import { Card, Column, Heading, Stat, Grid } from "@syncropel/react";

export function Dashboard() {
  return (
    <Card padding="lg">
      <Column gap="md">
        <Heading level={2}>Session</Heading>
        <Grid cols={3} gap="sm">
          <Stat label="Tracks" value={47} />
          <Stat label="Artists" value={14} delta={3} />
          <Stat label="Transitions" value={12} />
        </Grid>
      </Column>
    </Card>
  );
}

The component catalog

Layout

ComponentUse for
ColumnVertical flex container with gap, align, justify tokens
RowHorizontal flex container
GridCSS grid with cols (1–12) and gap
CardContainer with padding and optional interactive/selected state
DividerHorizontal or vertical separator with spacing

Content

ComponentUse for
Headingh1–h6 with typography tokens
TextParagraph/inline text (supports inline markdown: **bold**, *italic*, `code`, [link](url), ~~strike~~)
StatMetric tile: label, value, optional delta
KeyValueLabel + value pair
ChipInline label with optional glyph and tone
CodeInline monospace text

Interactive

ComponentUse for
ButtonPrimary/secondary/ghost/danger variants in xs/sm/md sizes
IconButtonIcon-only button
CopyButtonCopy-to-clipboard button with transient confirmation
LinkAnchor with href, styled consistently with Text

State

ComponentUse for
EmptyStateZero-state UI with message + optional action (combined)
ErrorStateError display with message + retry action (combined)
SkeletonPlaceholder (rect / circle / text shapes)
PulsePulsing animation wrapper for loading indicators

Semantic

ComponentUse for
GlyphSemantic icon, 21 fixed icons (INTEND, DO, KNOW, LEARN, GET, PUT, CALL, MAP, AITL, thread, fork, record-parent, namespace, actor, file, pattern, page, view, state-open, state-active, state-converged, state-closed, state-abandoned)
StatusDotStatus indicator with state prop

Theming via CSS variables

All design tokens are exposed as CSS custom properties at :root. Override in your own stylesheet:

/* your-app.css: loaded after @syncropel/react/styles.css */
:root {
  --sp-color-primary: #b45309;
  --sp-color-bg: #0a0a0a;
  --sp-spacing-md: 14px;
  --sp-font-sans: "Inter", system-ui, sans-serif;
  --sp-radius-md: 10px;
}

Token scales exposed:

  • Color: --sp-color-primary, --sp-color-secondary, --sp-color-bg, --sp-color-fg, --sp-color-muted, tones (info, success, warning, danger)
  • Spacing: --sp-spacing-none through --sp-spacing-xl
  • Typography: --sp-font-sans, --sp-font-mono, scale --sp-text-xs through --sp-text-lg
  • Radius: --sp-radius-sm through --sp-radius-lg

Because there's no provider, tokens follow normal CSS rules. Light and dark themes, per-component overrides and per-namespace accent colors are each a media query or class away.

Rendering a projection document

When you receive an SRP document from a workspace, walk the tree and map node types to components. A minimal renderer:

import { Card, Column, Row, Grid, Heading, Text, Stat, Chip } from "@syncropel/react";
import type { SRPNode } from "@syncropel/projections";

function Render({ node }: { node: SRPNode }) {
  switch (node.type) {
    case "column":
      return (
        <Column {...node.props}>
          {node.children?.map((child, i) => <Render key={i} node={child} />)}
        </Column>
      );
    case "grid":
      return (
        <Grid {...node.props}>
          {node.children?.map((child, i) => <Render key={i} node={child} />)}
        </Grid>
      );
    case "heading":
      return <Heading {...node.props} />;
    case "text":
      return <Text {...node.props} />;
    case "stat":
      return <Stat {...node.props} />;
    case "chip":
      return <Chip {...node.props} />;
    case "card":
      return (
        <Card {...node.props}>
          {node.children?.map((child, i) => <Render key={i} node={child} />)}
        </Card>
      );
    // ...cover the remaining 12 node types
    default:
      return null;
  }
}

A full renderer is short because the prop types match the SRP types.

What's next

On this page