Cloudflare's component library for building modern web applications.
Kumo provides accessible, design-system-compliant UI components built on Base UI. It handles keyboard navigation, focus management, and ARIA attributes so you can build accessible applications without thinking through every detail.
This is a pnpm monorepo containing seven packages. Two are published libraries; the other five are private sites and development tools that support the design system.
| Package | Purpose | Published |
|---|---|---|
@cloudflare/kumo |
Main React component library and source of truth for components, variants, design tokens, CSS, the component registry, installable blocks, and the Kumo CLI | Yes |
@cloudflare/kumo-astro |
Framework-independent Astro implementation of Kumo components, using vanilla JavaScript behavior modules instead of React | Yes |
@cloudflare/kumo-docs-astro |
Canonical documentation and demo site deployed at kumo-ui.com; its demo metadata feeds component-registry code generation | No |
@cloudflare/kumo-blocks |
Astro showcase of complete page and layout templates built from @cloudflare/kumo-astro |
No |
@cloudflare/kumo-studio |
AI-oriented documentation and blocks experience with actions that copy implementation prompts containing Kumo setup, token, and component guidance | No |
@cloudflare/kumo-figma |
Figma plugin that generates the Kumo UI kit from the component registry, design tokens, and icon data | No |
@cloudflare/kumo-screenshot-worker |
Authenticated Cloudflare Worker that uses Browser Rendering to capture docs pages and component examples for visual regression testing | No |
The core package and primary source of truth. It provides the React component library, Base UI primitive exports, semantic design tokens, generated CSS, component variants, component registry, installable blocks, and the kumo command-line tool. Blocks under packages/kumo/src/blocks/ are installed with kumo add; they are not normal library exports.
The Astro counterpart to the React library. It publishes .astro components without requiring React and implements interactive behavior such as focus trapping, popovers, tabs, and dialogs with browser JavaScript modules. It imports variant functions and types from @cloudflare/kumo so both implementations remain aligned.
The canonical documentation site. It uses an Astro shell with React islands to present component documentation, live demos, props tables, installation guidance, search, charts, colors, and changelogs. Its demo extractor produces dist/demo-metadata.json, which the core package consumes when generating the component registry.
A private Astro gallery for higher-level compositions rather than individual components. It demonstrates complete authentication, dashboard, form, hero, marketing, navigation, pricing, and settings layouts built primarily from @cloudflare/kumo-astro.
An AI-optimized variation of the documentation site. It adds Copy Prompt actions, embeds Kumo setup and semantic-token rules in those prompts, and includes the expanded block catalog. It is private and currently overlaps with both kumo-docs-astro and kumo-blocks; the canonical registry pipeline still reads demo metadata from kumo-docs-astro.
A Figma plugin that converts the code design system into a generated Figma UI kit. It creates Figma variables, component sets, variants, icons, and theme data. Drift-detection tests verify that its generators stay synchronized with the component registry.
Visual-regression infrastructure deployed as a Cloudflare Worker. It uses Puppeteer with Cloudflare Browser Rendering to open documentation pages, run optional browser actions, and capture full pages or specific component examples. The API is protected by an API key and validates target URLs.
@cloudflare/kumo
├── React components, tokens, variants, CSS, registry, CLI
├── shares variants and styles with @cloudflare/kumo-astro
├── is documented by kumo-docs-astro
└── supplies registry and token data to kumo-figma
@cloudflare/kumo-astro
├── Astro component implementation
├── is used by kumo-blocks
└── is used by kumo-studio blocks
kumo-docs-astro
├── supplies demo metadata to Kumo registry code generation
└── provides pages captured by kumo-screenshot-worker
kumo-studio
└── provides an AI-oriented documentation and blocks experience
pnpm add @cloudflare/kumopnpm add react react-dom @phosphor-icons/reactimport { Button, Input, Dialog } from "@cloudflare/kumo";
import "@cloudflare/kumo/styles";import { Button } from "@cloudflare/kumo/components/button";Kumo re-exports all Base UI primitives for advanced use cases:
import { Popover } from "@cloudflare/kumo/primitives/popover";Framework-agnostic .astro components with the same design tokens and variants as @cloudflare/kumo. No React required.
pnpm add @cloudflare/kumo-astropnpm add astro
# Optional: phosphor icon web fonts
pnpm add @phosphor-icons/webImport components via subpath exports:
---
import Button from "@cloudflare/kumo-astro/components/button";
import Badge from "@cloudflare/kumo-astro/components/badge";
---
<Button variant="primary">Click me</Button>
<Badge variant="info">New</Badge>Import styles (Tailwind v4 + kumo design tokens):
---
import "@cloudflare/kumo-astro/styles";
---See packages/kumo-astro/src/components/ and the package's exports map for the current component list and import paths.
import { cn, resolveVariant, safeRandomId } from "@cloudflare/kumo-astro";Query component documentation from the command line:
npx @cloudflare/kumo ls # List all components
npx @cloudflare/kumo doc Button # Get component docs
npx @cloudflare/kumo docs # Get all docsSee AGENTS.md for comprehensive development documentation including:
- Component patterns and styling system
- Semantic color tokens
- Development workflows
- CI/CD pipeline
- Figma plugin
pnpm install
pnpm dev # Start docs site at localhost:4321Important:
pnpm dev(the docs site) depends on the built output of@cloudflare/kumo. If you get a "Cannot find module" error on first run, build the library first:pnpm --filter @cloudflare/kumo build pnpm dev
| Package | What to run |
|---|---|
packages/kumo |
pnpm --filter @cloudflare/kumo build — build the library; pnpm --filter @cloudflare/kumo test — unit tests; pnpm --filter @cloudflare/kumo new:component — scaffold a new component |
packages/kumo-astro |
pnpm --filter @cloudflare/kumo-astro test — Playwright tests; pnpm --filter @cloudflare/kumo-astro typecheck — validate Astro components |
packages/kumo-docs-astro |
pnpm dev from repo root (or pnpm --filter @cloudflare/kumo-docs-astro dev) — canonical docs site at localhost:4321 |
packages/kumo-blocks |
pnpm --filter @cloudflare/kumo-blocks dev — block showcase; pnpm --filter @cloudflare/kumo-blocks build — static build |
packages/kumo-studio |
pnpm --filter @cloudflare/kumo-studio dev — AI-oriented docs and blocks experience |
packages/kumo-figma |
pnpm --filter @cloudflare/kumo-figma build — build the Figma plugin |
packages/kumo-screenshot-worker |
pnpm --filter @cloudflare/kumo-screenshot-worker dev — run the screenshot Worker locally; requires an API_KEY in .dev.vars |
Build order matters. The packages depend on each other in sequence:
1. pnpm --filter @cloudflare/kumo build # Build the React library (generates dist/)
2. pnpm dev # Docs site (requires kumo dist/)
3. pnpm --filter @cloudflare/kumo codegen:registry # Regenerate component registry (requires docs demos)
4. pnpm --filter @cloudflare/kumo-figma build # Figma plugin (requires component registry)
pnpm lint
pnpm typecheck
pnpm --filter @cloudflare/kumo test # Run kumo unit tests
pnpm test:astro # Run kumo-astro Playwright tests
pnpm changeset # Create a changeset (required when modifying kumo or kumo-astro)The docs site (packages/kumo-docs-astro) has two separate deployment targets, each with their own set of scripts.
| Script | Command | What it does |
|---|---|---|
deploy:kumo-docs-preview |
bash ci/versioning/deploy-kumo-docs-preview.sh |
Uploads a new Worker version without making it live; produces a per-version preview URL for PR comments |
deploy:kumo-docs-staging |
bash ci/versioning/deploy-kumo-docs-staging.sh |
Deploys live to the kumo-docs-staging Worker (staging.kumo-ui.com) |
| Script | Command | What it does |
|---|---|---|
deploy:kumo-docs-astro-preview |
bash ci/versioning/deploy-kumo-docs-astro-preview.sh |
Same as above but targets the astro-staging wrangler env on the new account |
deploy:kumo-docs-astro-staging |
bash ci/versioning/deploy-kumo-docs-astro-staging.sh |
Deploys live to the kumo-docs-astro Worker on the new account (workers.dev, no custom domain) |
To run locally, export credentials first:
export CLOUDFLARE_API_TOKEN=your_token
export CLOUDFLARE_ACCOUNT_ID=2f3dc21d188ba781322b520bbde5fb5a
pnpm deploy:kumo-docs-astro-stagingThe Astro docs scripts target a separate Cloudflare account. The CLOUDFLARE_API_TOKEN used must have permissions on that account. If your existing token only covers the original account, you have two options:
- Grant the existing token access to the new account in the Cloudflare dashboard (API Tokens → edit token → add the new account under "Account Resources").
- Use a separate token — introduce a new secret (e.g.
CLOUDFLARE_ASTRO_API_TOKEN) and update the scripts to read from it instead ofCLOUDFLARE_API_TOKEN.
The scripts currently read CLOUDFLARE_API_TOKEN. If you add a separate secret, update the variable name in both ci/versioning/deploy-kumo-docs-astro-preview.sh and ci/versioning/deploy-kumo-docs-astro-staging.sh, and add the new secret to GitHub Actions (repo Settings → Secrets → Actions).
The preview scripts use wrangler versions upload rather than wrangler deploy. The difference:
wrangler versions upload— uploads a new version but does not make it live. Wrangler returns a per-version preview URL (https://<version-prefix>-<worker-name>.<subdomain>.workers.dev) that can be shared in a PR comment without affecting production or staging traffic.wrangler deploy— immediately makes the new version live to 100% of traffic on the target environment.
The extra code in the preview scripts captures the version ID/URL from wrangler's output (constructing it from the version ID if wrangler doesn't print it directly), then writes it to ci/reports/kumo-docs-preview.json so the PR reporter job can post it as a GitHub comment.
If you don't need per-PR preview URLs in GitHub comments, the staging scripts — which are just a build + wrangler deploy --env <env> — are all you need.
Five workflows run on every pull request:
| Workflow | Trigger | What it does |
|---|---|---|
pullrequest.yml |
pull_request, push to opencode/** |
Changeset validation, build, lint, typecheck, unit tests (kumo + kumo-astro Playwright) |
preview.yml |
pull_request, push to opencode/** |
pkg-pr-new installable preview for both packages, docs site preview deploy, visual regression |
preview-deploy.yml |
workflow_run (after Preview) |
Fork-safe docs deploy — uses secrets unavailable to fork PRs |
release.yml |
push to main |
Changesets version PR or npm publish for both packages |
reviewer.yml |
PR review comment /review |
AI code review via ask-bonk |
Both @cloudflare/kumo and @cloudflare/kumo-astro require a changeset on every PR that modifies their source. The pre-push hook (lefthook) and CI enforce this automatically.
pnpm changeset # follow prompts — select the package(s) you changedChangesets are not required for kumo-docs-astro (docs site) or kumo-figma (Figma plugin).
Every PR publishes an installable preview of both packages via pkg-pr-new. The install command is posted as a PR comment automatically.
# Publish a beta of @cloudflare/kumo
pnpm publish:beta
# Publish a beta of @cloudflare/kumo-astro
PACKAGE_NAME=@cloudflare/kumo-astro PACKAGE_PATH=packages/kumo-astro pnpm publish:betaThe packages/kumo-figma package is a Figma plugin that programmatically generates Figma UI components from the Kumo component registry. It performs a one-way, destructive sync: every run purges and recreates all components in the Figma file using component-registry.json as the source of truth.
Build pipeline (sequential):
pnpm build
1. sync:maybe → Syncs design tokens to Figma REST API (only if FIGMA_TOKEN set)
2. build:data → Generates theme-data.json, loader-data.json, phosphor-icons.json,
figma-variables.json into src/generated/
3. build:plugin → esbuild bundles src/code.ts → src/code.js (IIFE, ES2017)
Token sync (scripts/sync-tokens-to-figma.ts) pushes design tokens into a Figma Variables collection via the REST API. Configure in packages/kumo-figma/scripts/.env:
cp packages/kumo-figma/scripts/.env.example packages/kumo-figma/scripts/.env
# Set FIGMA_TOKEN (personal access token from Figma Settings > Personal Access Tokens)
# Set FIGMA_FILE_KEY (from the Figma file URL)Without FIGMA_TOKEN, the token sync step is silently skipped.
Running the plugin in Figma:
pnpm --filter @cloudflare/kumo-figma build
# In Figma: Plugins > Development > Import plugin from manifest...
# Select: packages/kumo-figma/src/manifest.jsonThe plugin destructively syncs a single "ui kit" page, running 37+ generators to create light/dark mode component sets for each library component.
Cross-package dependency: The plugin depends on @cloudflare/kumo's component registry. After changing library components, regenerate the registry before building the plugin:
pnpm --filter @cloudflare/kumo codegen:registry
pnpm --filter @cloudflare/kumo-figma buildNote:
src/generated/is gitignored. Runpnpm --filter @cloudflare/kumo-figma build:dataafter cloning or switching branches, or tests will fail.
The packages/kumo-screenshot-worker package is a Cloudflare Worker that provides headless-browser screenshot services for visual regression testing of the docs site. It uses @cloudflare/puppeteer connected to Cloudflare Browser Rendering (managed headless Chromium).
How it works:
POST /batch— accepts a list of URLs, navigates each with Puppeteer, and returns PNG screenshots (base64 and/or stored in R2)GET /screenshots/*— serves stored screenshots from R2 (used by CI for PR report images)PUT /screenshots/*— uploads PNGs to R2 (used by CI to store pixel-diff images)
Docs site integration: ComponentPreview.astro stamps data-vr-demo, data-vr-section, and data-vr-title attributes on every demo wrapper. The worker queries [data-vr-demo] elements and screenshots each individually.
CI flow: On every PR, preview.yml deploys the docs to a preview URL then calls the worker twice — once against production (before) and once against the preview (after). pixelmatch diffs the results and posts a before/after/diff image table as a PR comment.
Smart scoping: The CI script inspects git diff to decide scope — only changed components, three canary components (for broad style changes), or skipped entirely (for docs/config-only changes).
Setup — Worker secrets (wrangler secret put):
| Secret | What it's for | How to get it |
|---|---|---|
API_KEY |
Authenticates all calls to the screenshot Worker | openssl rand -hex 32 — generate yourself |
For local dev, copy .dev.vars.example → .dev.vars inside packages/kumo-screenshot-worker/ and set the key there.
Setup — GitHub Actions secrets (repo Settings → Secrets → Actions):
| Secret | What it's for | How to get it |
|---|---|---|
SCREENSHOT_API_KEY |
Same value as API_KEY above — injected into CI to call the Worker |
Copy the same string you put in the Worker |
CLOUDFLARE_API_TOKEN |
wrangler auth for deploying the docs preview (required for the "after" URL) |
Cloudflare dashboard → My Profile → API Tokens → "Edit Cloudflare Workers" template |
CLOUDFLARE_ACCOUNT_ID |
Tells wrangler which account to target | Cloudflare dashboard → right sidebar "Account ID" |
GITHUB_TOKEN |
Posts/updates the VR report as a PR comment | Auto-injected by Actions — no setup needed |
Setup — Cloudflare infrastructure:
| Resource | What it's for | How to provision |
|---|---|---|
Browser Rendering binding (BROWSER) |
Puppeteer connects to this for headless Chromium | Cloudflare dashboard → Worker → Settings → enable Browser Rendering |
R2 bucket (kumo-visual-regression) |
Stores before/after/diff PNGs; serves them in PR comments | wrangler r2 bucket create kumo-visual-regression |
Note:
API_KEYandSCREENSHOT_API_KEYare the same secret stored in two places. If you rotate one, rotate both.
pnpm --filter @cloudflare/kumo new-component- Live Docs: kumo-ui.com
- AI/Agent Guide: AGENTS.md
MIT