Customizing Drupal Paragraphs with Style Options: A Lightweight, Modular Approach

a person working in computer
Freepik

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.

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related People

Upcoming Events

Latest Opportunities