This Statamic addon gives you the ability to add custom paragraph styles to the Bard fieldtype.
Install the addon using Composer:
composer require jacksleight/bard-paragraph-style
Publish the config:
php please vendor:publish --tag=bard-paragraph-style-config
config/bard-paragraph-style.php and add your paragraph styles:
return [ 'styles' => [ [ 'name' => 'Introduction Paragraph', 'ident' => 'I', 'class' => 'intro', 'button' => 'introduction', 'cp_css' => 'font-size: 1.25em', ], ], ];
Each style should consist of:
- name (string): The name of the style. This will appear in the button tooltip.
- ident (string): A short identification string (one or two characters). This will appear in the button icon.
- class (string): The class name that will be applied to the paragraph element when rendered on the site.
- button (string): The name of the button that'll be added to the Bard field's buttons list.
- cp_css (string): The CSS properties that will be added to the control panel for this style.
Finally open your blueprint or fieldset YAML file and add the button(s) to your Bard field's buttons list:
- handle: my_field field: type: bard buttons: - introduction