Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

CL Preview

No security coverage
View on drupal.org

CL Preview is a Drupal-native library browser that allows you to preview and test Single Directory Components (SDC) directly within Drupal, eliminating the need for external build tools like Node.js or Webpack. It automatically discovers components from your themes and modules and provides an organized interface with live previews and hot reloading.

Note: This is an experimental module and is not yet complete. Please avoid opening issues for now.

CL Preview is a Drupal-native component library browser for previewing and testing Single Directory Components (SDC). A great alternative to Storybook that works entirely within Drupal without requiring Node.js, Webpack, or any external build tools.

Features

  • Component Library Browser - Organized interface with navigation and live component previews
  • Hot Reload - Automatically refreshes when component files change
  • Preview Values - Define custom preview data in component.yml for better demos
  • No Story Files - No need for .stories.yml, .stories.json, or MDX files
  • Theme Switching - Preview components in any installed theme
  • Auto-Discovery - Automatically finds SDC components from configured themes/modules
  • No Build Step - Pure Drupal solution with no external tooling required

CL Preview is ideal for frontend developers building design systems, teams documenting component libraries, and projects wanting a native Drupal alternative to Storybook.

Post-Installation

  1. Enable: drush en cl_preview -y
  2. Configure: /admin/config/development/cl-preview/settings
    • Select themes/modules to scan for components
    • Choose preview theme (optional)
    • Enable hot reload (optional)
  3. View Library: /admin/config/development/cl-preview
  4. Permissions: Grant "Access CL component library" to appropriate roles

Improving Preview Display with Preview Values

By default, components may render with empty or minimal data if they only have basic defaults. To create better demonstrations in the component library, add a preview section to your existing *.component.yml files with meaningful sample data. No separate story files needed!

# your-component.component.yml
props:
  type: object
  properties:
    title:
      type: string
      default: ''
    variant:
      type: string
      default: primary

# Add preview values for better demos
# No need for .stories.yml or .stories.json files!
preview:
  title: Example Title
  description: Sample content
  variant: primary

Preview Value Hierarchy: The module uses preview values first, then falls back to prop defaults, then type-based defaults (empty string, 0, false, [], etc.). This means your preview section will override any defaults defined in the props, giving you complete control over how components appear in the library.

The preview page will highlight props with empty values in red to help you identify which components need better preview data. See the full README for more details.

Additional Requirements

  • Drupal 10.1+ with SDC module (core)
  • At least one theme or module with SDC components (components/ directory with *.component.yml files)

Comparison

Why CL Preview is a great alternative to Storybook:

  • No Node.js, Webpack, or build tools required
  • No separate installation or deployment
  • No .stories.yml, .stories.json, or MDX files to create or maintain
  • Native Drupal integration using the render system
  • Automatic component discovery from existing .component.yml files

vs. SDC Examples: Hot reload, organized library interface

vs. Pattern Lab: No separate installation, works directly with Drupal's SDC system

Community Documentation

Full documentation including troubleshooting, value hierarchy, interactive features, and extending the module is available in the module's README.md file.

Credits

Co-authored with Claude Code - AI pair programming assistant by Anthropic.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Oct 2025
Latest release
10 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
1.0.x-dev Dev 10 Oct 27, 2025