I. Use classy paragraphs to add classes to paragraphs as a field, select or autocomplete for Drupal 8
First create classy paragraph styles
-
In terminal download paragraphs: composer require drupal/paragraphs
-
Enable paragraphs
-
In terminal down classy paragraphs: composer require drupal/classy_paragraphs
-
Enable classy paragraphs
-
Navigate to structures->classy paragraph style and click “add classy paragraph style” button
-
Create style classes and labels, must create associated class rules in css.
Next create a paragraph field that uses a classy paragraph style.
-
Add a field in an existing paragraph.
-
Select “reference” -> “other”
-
Add field name
-
In “type of item to reference” select “classy paragraphs style”
-
Also select “unlimited” or “limited” depending on how many styles fields you want available. (select lists can only deliver one style, but if you change the widget and did not select “unlimited” it’s hard to redo once you create content.
II. Block Field
-
Download block_field module for drupal 8 : $ composer require drupal/block_field.
-
In content type or paragraph type add field in “Add a new field” select choose “Block (plugin” under “Reference”).