Skip to content

A custom button for Bard in Statamic 3 to allow a span with a class to be added to selected text. In this instance, Les Mills group fitness class types.

Notifications You must be signed in to change notification settings

bellevue7k/span-classes

 
 

Repository files navigation

Bard add-on for Statamic 3 for adding a span and class to selected content

Statamic 3.0+

This is an example Bard addon for Statamic 3 that adds a span with a class to selected content.

Installation

Install it via the composer command

composer require bellevue7k/span-classes

In your Bard editor instances (note, not the configuration view), you'll see the new button added.

Select some text, click the new icon, and select a class type, and voilà!

Output

When output, the markup will be a span with a class attached.

<p>This is my text with <span class="whiteSpace-noWrap">whiteSpace-noWrap</span> highlighted using the addon.</p>

Use on the front end

You will need to add classes to your front end stylesheets to see them come through there too.

A finished class might be whiteSpace-noWrap for example.

Your CSS for your frontend can then target that specific class.

.whiteSpace-noWrap {
    hyphens:none;
        
    /* more class types */
}

License

This addon is licensed under the MIT license.

About

A custom button for Bard in Statamic 3 to allow a span with a class to be added to selected text. In this instance, Les Mills group fitness class types.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 38.5%
  • Vue 33.2%
  • PHP 17.5%
  • CSS 10.8%