Storyblok
Storyblok Sync Quick Start
Automatische Synchronisation von Design Tokens und Component Schemas zu Storyblok
Setup
- Add environment variables to
.env.local:
# Get from: https://app.storyblok.com/#!/me/account?tab=token
STORYBLOK_MANAGEMENT_TOKEN=your-personal-access-token
# Find in: Storyblok Settings β General
STORYBLOK_SPACE_ID=your-space-id- Sync component groups (folders):
pnpm --filter @httpjpg/storyblok-sync sync:groups- Sync datasources (design tokens):
pnpm --filter @httpjpg/storyblok-sync sync:datasources- Sync components (schemas):
pnpm --filter @httpjpg/storyblok-sync sync:components- Or sync everything (runs all in correct order):
pnpm --filter @httpjpg/storyblok-sync sync:allWhat Gets Created
Datasources (11 total)
Spacing & Layout:
spacing-options- None, XS, Small, Medium, Large, XL, 2XL, 3XL, 4XLwidth-options- Full Width, Container, Narrowgrid-columns- 1-6 Columns, Auto Fitaspect-ratio-options- 16:9, 4:3, 1:1, 3:4, 9:16, 21:9
Colors:
background-color-options- White, Black, Gray, Primary, Accenttext-color-options- Text colors
Typography:
font-family- Sans, Headline, Accent, Monofont-size- Small, Medium, Base, Large, XLfont-weight- Light, Normal, Medium, Semibold, Bold, Black
Animations:
animation-duration- Fast, Normal, Slowanimation-easing- Linear, Ease, Ease In/Out
Component Groups (3 folders)
Organize components in the Block Library:
- π Layout - Section, Container, Grid
- π Content - Headline, Paragraph
- π Media - Image, Video, Slideshow
Components (8 total)
Layout (π):
section- Semantic section wrapper with responsive spacingcontainer- Content container with width optionsgrid- Responsive grid layout
Content (π):
headline- H1-H3 headings with styling optionsparagraph- Body text with styling options
Media (π):
image- Responsive images with aspect ratiovideo- Video player (Asset/YouTube/Vimeo)slideshow- Image carousel
Each component includes:
- β Custom icon and color
- β Field descriptions and tooltips
- β Datasource integration for token-based values
- β Component whitelists for nested blocks
Using in Storyblok
Step 1: Component Schemas
Components are automatically available in Visual Editor after sync.
Step 2: Configure Fields
For dropdown fields:
- Edit component schema
- Find field (e.g., "Padding Top")
- Set "Source" to "Datasource"
- Select datasource (e.g., "spacing-options")
Step 3: Nested Bloks
For content or body fields:
- Edit component schema
- Find bloks field
- Configure "Allowed Components" whitelist
- Add components that can be nested
Example: Creating a Page
In Storyblok Visual Editor:
- Create new story
- Add
sectioncomponent - Configure spacing:
- Padding Top: "Medium" β maps to
8β 2rem - Padding Bottom: "Large" β maps to
16β 4rem
- Padding Top: "Medium" β maps to
- Add nested components to
content:- Add
headlinewith text "Hello World" - Add
paragraphwith body text
- Add
- Preview updates live!
Workflow
graph LR
A[Code Tokens] -->|sync:datasources| B[Storyblok Datasources]
C[TypeScript Interfaces] -->|sync:components| D[Storyblok Components]
B --> E[Visual Editor Dropdowns]
D --> E
E -->|Editor selects| F[Mapped Values]
F -->|Rendering| G[Design Tokens]
G -->|Panda CSS| H[Compiled CSS]See Also
- Full docs:
packages/storyblok-sync/README.md - Datasource docs:
docs/STORYBLOK_DATASOURCES.md - Example components:
docs/STORYBLOK_DATASOURCES_EXAMPLES.md