Add a class selector to the create link dialog
From Joomla! Documentation
Description[edit]
This feature allows users to easily add CSS classes to links directly from the tinyMCE editor. Whether you're looking to apply specific styles or transform links into interactive elements like buttons, this option significantly simplifies the process of customizing links in your articles. It eliminates the need to manually edit the source code, enabling users to quickly apply predefined styles or add advanced visual effects. Users can select from a range of predefined classes, such as those from Bootstrap, to enhance the appearance and interaction of links. This provides a way to enrich link formatting without having to modify HTML code directly.
Enhance Link Styling with the Class Selector[edit]
Starting from Joomla 5.2, you can now easily add custom CSS classes to links using the tinyMCE editor. This new feature allows you to style your links without directly editing the source code of your articles. By adding Bootstrap classes, for example, you can quickly transform a link into a button or add specific visual effects. Here’s a guide to help you make the most of this new option.
Steps to Use the Class Selector[edit]
- Access the tinyMCE configuration: Go to the tinyMCE editor configuration and open the "Advanced" tab.
- Add classes to the dropdown: In the "Advanced" tab, you can add CSS classes that you want to use for styling your links. For instance, Bootstrap classes to create stylish buttons.
You can find examples for templates that natively use Bootstrap in the official documentation: Bootstrap Documentation
Here are some classes you can use for Bootstrap button variants:
btn btn-primary
for a primary buttonbtn btn-secondary
for a secondary buttonbtn btn-success
for a success buttonbtn btn-danger
for a danger buttonbtn btn-warning
for a warning buttonbtn btn-info
for an info buttonbtn btn-light
for a light buttonbtn btn-dark
for a dark buttonbtn btn-link
for a link button
Outline Button Alternatives[edit]
You can also use the outline button variants:
btn btn-outline-primary
for an outlined primary buttonbtn btn-outline-secondary
for an outlined secondary button- … (etc.)
For button sizes, add these classes[edit]
btn-lg
for a large buttonbtn-sm
for a small button
Example:
btn btn-dark btn-lg
(a large dark button)
Create a link in an article[edit]
Open an article and create a link. At the bottom of the link creation dialog, you will see an option to select the configured classes.
Advanced Use: Applying Custom Classes[edit]
This feature isn’t limited to Bootstrap classes. You can also apply your own custom CSS classes for specific needs. For example, you can add an icon before the link with a hover effect. This makes it easy to style links without needing to modify the article's source code.
Note on the Feature's Origin[edit]
This feature was added in Joomla 5.2 via PR #43260.