Customizing Drupal Paragraphs with Style Options: A Lightweight, Modular Approach
Mario Hernandez introduces a streamlined approach to customising Drupal Paragraph types using the Style Options module alongside the popular Paragraphs module.
Designed for developers seeking clean styling workflows, the Style Options module allows YAML-driven configuration of layout variants without adding new fields or view modes. By passing CSS classes through the attributes variable, developers can enable frontend customisation without increasing database complexity.
The blog focuses on the CSS Class plugin—one of three included—to manage visual variation in components. Mario walks through a practical YAML example for image alignment within a Card paragraph, and explains how Drupal tracks option selections using zero-based index values. He cautions that reordering or removing options post-deployment can lead to mismatches between database-stored values and the intended display.
To address this, Hernandez recommends using preprocessors or data migration scripts when editing existing options. He also advises developers to avoid overloading editors with too many choices, keeping UX focused and effective. The post closes with pointers to other plugins in the module and to the related Layout Options module for more advanced layout control.


