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/projectionsRequires 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
| Component | Use for |
|---|---|
Column | Vertical flex container with gap, align, justify tokens |
Row | Horizontal flex container |
Grid | CSS grid with cols (1–12) and gap |
Card | Container with padding and optional interactive/selected state |
Divider | Horizontal or vertical separator with spacing |
Content
| Component | Use for |
|---|---|
Heading | h1–h6 with typography tokens |
Text | Paragraph/inline text (supports inline markdown: **bold**, *italic*, `code`, [link](url), ~~strike~~) |
Stat | Metric tile: label, value, optional delta |
KeyValue | Label + value pair |
Chip | Inline label with optional glyph and tone |
Code | Inline monospace text |
Interactive
| Component | Use for |
|---|---|
Button | Primary/secondary/ghost/danger variants in xs/sm/md sizes |
IconButton | Icon-only button |
CopyButton | Copy-to-clipboard button with transient confirmation |
Link | Anchor with href, styled consistently with Text |
State
| Component | Use for |
|---|---|
EmptyState | Zero-state UI with message + optional action (combined) |
ErrorState | Error display with message + retry action (combined) |
Skeleton | Placeholder (rect / circle / text shapes) |
Pulse | Pulsing animation wrapper for loading indicators |
Semantic
| Component | Use for |
|---|---|
Glyph | Semantic 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) |
StatusDot | Status 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-nonethrough--sp-spacing-xl - Typography:
--sp-font-sans,--sp-font-mono, scale--sp-text-xsthrough--sp-text-lg - Radius:
--sp-radius-smthrough--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
- Projections SDK: the schema these components render
- TypeScript SDK: query records whose bodies are projection documents
- Extensions SDK: build iframe extensions that consume projection streams
Python SDK
Use Syncropel from Python: add records, query threads, and keep your app running through network errors.
Extensions SDK
Build small apps that run inside a Syncropel workspace. The SDK handles the connection to the workspace, the permissions your app asks for, and writing, querying and subscribing to records.