For infrastructure deployment (GCP/Firebase/NPM), see DEPLOYMENT_GUIDE.md
For Token Engine API & CLI reference, see BLEND_TOKEN_STUDIO.md
This file covers: How to install and use Blend components in your project.
Blend Design System has two pieces:
| Piece | Package | What it does |
|---|---|---|
| Component Library | @juspay/blend-design-system |
React components (Button, Input, Alert, etc.) + Token Engine |
| CLI | blend-studio |
Scaffolds projects, generates tokens, syncs with Studio |
The flow:
Studio (web editor) → brand.json → CLI pull → tokens.ts → <ThemeProvider> → Your App
You write ~20 lines of JSON (your brand colors, radius, font). The token engine expands it into ~10,000+ resolved token values that every Blend component consumes.
# 1. Install the component library
npm install @juspay/blend-design-system styled-components
# 2. Scaffold your project
npx blend-studio init
# 3. Apply a brand preset
npx blend-studio brand --preset juspay
# 4. Wrap your app
# In your root layout:
import { BlendProvider } from './src/blend/provider'
<BlendProvider><App /></BlendProvider>That's it. All Blend components now use your brand colors and radius.
- React 18+
- styled-components 6+
# With pnpm (recommended)
pnpm add @juspay/blend-design-system styled-components
# With npm
npm install @juspay/blend-design-system styled-components
# With yarn
yarn add @juspay/blend-design-system styled-componentsimport { ButtonV2 } from '@juspay/blend-design-system'
function App() {
return <ButtonV2>Click me</ButtonV2>
}If this renders, the component library is installed correctly.
The CLI is used via npx — no global install needed:
npx blend-studio --version# Interactive login (opens prompt for JWT token)
npx blend-studio login
# Or with a token directly
npx blend-studio login --token <your-jwt>
# Or via environment variable (for CI)
export BLEND_STUDIO_API_TOKEN=<your-jwt>- Open Blend Token Studio
- Sign in with Google
- Open the user menu (top right) → API Token (for CLI)
- Copy the token
npx blend-studio whoami
# Output: Logged in as: you@company.comnpx blend-studio logoutnpx blend-studio initThis command:
- Detects your project type (Next.js, Vite, CRA, or ReScript)
- Installs missing dependencies (
@juspay/blend-design-system,styled-components) - Creates
blend.config.jsonwith defaults - Generates
src/blend/provider.tsx— the wrapper component - Generates
src/blend/tokens.ts— default (Blend) tokens
| Flag | Description |
|---|---|
--defaults |
Skip prompts, use defaults |
--force |
Overwrite existing files |
your-project/
├── blend.config.json # Project config (brand, output dir, studio URL)
└── src/blend/
├── provider.tsx # <BlendProvider> wrapper — safe to edit
└── tokens.ts # Resolved tokens — auto-generated, don't edit
// app/layout.tsx (Next.js) or src/main.tsx (Vite)
import { BlendProvider } from './src/blend/provider'
export default function RootLayout({ children }) {
return <BlendProvider theme="light">{children}</BlendProvider>
}npx blend-studio brandWalks you through picking a primary color, radius style, etc.
npx blend-studio brand --preset juspayAvailable presets: blend, juspay, purple, green, orange
npx blend-studio brand --primary "#E11D48" --radius rounded- Updates
src/blend/tokens.tswith your branded tokens - All Blend components immediately reflect your brand when the app reloads
Blend Token Studio is the web UI for visually editing brand tokens.
Open studio.blend.juspay.design and sign in with Google.
- Create a Workspace — each workspace holds a brand config
- Edit tokens — change colors, radius, shadows, typography, per-component overrides
- Preview — see live component previews with your brand
- Publish — version your brand config
- Pull — CLI downloads the published config into your project
| Developer Concept | Studio UI Label |
|---|---|
| Branch | Workspace |
| Default Branch | Master Theme |
| Fork | Duplicate |
| Merge Request | Change Request |
| Publish | Release |
# Pull the latest version of a workspace
npx blend-studio pull my-org/retail
# Pull a specific version
npx blend-studio pull my-org/retail --version 1.2.0
# Pull with ReScript output
npx blend-studio pull my-org/retail --language rescript
# Pull for CI (no prompts, JSON output)
npx blend-studio pull my-org/retail --ci --format json| File | Contents |
|---|---|
tokens.ts |
Resolved light + dark tokens as TypeScript |
brand.json |
The raw brand config (for version control) |
studio.json |
Metadata (branch ID, version, pull timestamp) |
If you have a brand.json but no Studio access:
npx blend-studio generate ./brand.json
npx blend-studio generate ./brand.json --language rescriptThe CLI auto-detects ReScript projects via:
rescript.jsonorbsconfig.jsonin project rootrescriptor@rescript/corein dependencies
npx blend-studio init
# The CLI will detect ReScript and configure accordingly# From Studio
npx blend-studio pull my-org/retail --language rescript
# From local brand.json
npx blend-studio generate ./brand.json --language rescriptGenerates src/blend/BlendTokens.res:
/** Light theme */
let componentTokens: JSON.t = %raw(`{ ... }`)
/** Dark theme */
let darkComponentTokens: JSON.t = %raw(`{ ... }`)| Variable | Description | Required |
|---|---|---|
BLEND_STUDIO_API_TOKEN |
JWT token for Studio API | Yes |
BLEND_STUDIO_API_URL |
Override Studio API URL | No |
name: Update Tokens
on:
workflow_dispatch:
jobs:
pull-tokens:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Pull tokens
env:
BLEND_STUDIO_API_TOKEN: ${{ secrets.BLEND_STUDIO_API_TOKEN }}
run: npx blend-studio pull my-org/retail --ci --format json
- name: Commit updated tokens
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add src/blend/
git diff --cached --quiet || git commit -m "chore: update brand tokens"
git push| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Failure (auth, network, validation) |
The --ci flag ensures:
- No interactive prompts
- Non-zero exit on failure
--format jsonoutputs machine-readable JSON
Blend uses a 3-tier inheritance model:
Blend Foundation (default theme)
└── Org Master Theme (org-level overrides, some tokens locked)
└── Product Workspace (product overrides, respects locks)
- The org admin sets brand defaults and marks certain tokens as locked (e.g. primary color must stay blue)
- Product teams create workspaces that inherit from the org master
- Product teams can override any non-locked token
- If a product tries to override a locked token, the system blocks it
Org admins can lock tokens in Studio:
- Go to Organization Settings → Token Locks
- Add a token path (e.g.
colors.primary.500) and a reason - All child workspaces must respect this lock
When an editor wants to promote changes from a workspace to the master theme:
- Create a Change Request (Merge Request)
- Org admin reviews the diff
- Approve or reject with comments
For full publishing workflow, see DEPLOYMENT_GUIDE.md
- Create an NPM token at npmjs.com → Access Tokens → Generate New Token
- Add the secret to your GitHub repository:
- Go to Settings → Secrets and variables → Actions
- Create an Environment called
npm - Add
NPM_TOKENsecret to that environment
- Go to Actions → Publish CLI (blend-studio)
- Click Run workflow
- Select version bump type, tag, and confirm
npx blend-studio login
# Or: export BLEND_STUDIO_API_TOKEN=<your-token>Get a fresh token from Studio → User Menu → API Token.
npx blend-studio init- Make sure
<BlendProvider>wraps your app - Make sure
tokens.tshas actual values (not empty{}) - Run
npx blend-studio brandto regenerate
Brand config colors must be in #RGB or #RRGGBB format. No rgb(), hsl(), or named colors.
The validator checks color scales against white and dark backgrounds. Pick a darker or lighter shade for that color.
npx blend-studio pull my-org/retail --language rescript
npx blend-studio generate ./brand.json --language rescript