Previewing Drupal 11 SDCs with Storybook: A Practical Guide
In his latest guide, Phil Norton walks developers through previewing Single Directory Components (SDCs) in Drupal 11 using Storybook, a JavaScript-based component explorer for live UI testing outside of Drupal templates.
The article explains how to create an example “Author” component complete with markup, styles, and configuration, and render it using the Drupal Storybook module. Phil also covers npm setup, defining stories, configuring CORS, and hosting locally via DDEV—allowing teams to build components in isolation, maintain design consistency, and present polished demos before integration.
The comprehensive tutorial includes YAML definitions, Twig templates, and CSS setup for the SDC, and dives into how Storybook interacts with Drupal via Drush commands and .stories.twig/.stories.json files. It concludes with advanced topics like DDEV integration, Storybook configuration, and options for static hosting.
Whether previewing components for internal reviews or client demos, the Storybook workflow enhances SDC development by enabling real-time feedback and visual validation before deployment. Phil emphasizes that if you're building with SDCs, you should also be using Storybook.


