diff --git a/docs/design/accordion.rst b/docs/design/accordion.rst new file mode 100644 index 00000000..c6ec3025 --- /dev/null +++ b/docs/design/accordion.rst @@ -0,0 +1,136 @@ +.. vale off + +Accordion component +=================== + +.. vale on + +Introduction +------------ + +The Accordion Component allows developers to create collapsible sections within their Mautic templates. This Component is useful for organizing content into expandable and collapsible panels, enhancing the User experience by making large amounts of content more manageable. + + +Template structure +------------------ + +The ``accordion.html.twig`` template defines this accordion component. The template employs a list structure ``
This is a simple content example.
', + } + ] + } %} + +This flexibility allows you to choose the best approach based on each case. + +Automatic CSS handling +---------------------- + +When using the Component, all necessary CSS styles are automatically handled for you. This means that the Component comes pre-styled with classes such as ``accordion-heading``, ``accordion-wrapper``, and ``accordion-content``, ensuring a consistent and visually appealing appearance out of the box. + +- The Component includes predefined CSS classes that manage the layout, spacing, and interactive elements of the accordion. +- You don't need to add any extra CSS to make the accordion function and look visually appealing. +- It uses the existing Bootstrap function for collapsing panels. +- Avoid overriding these classes in your own CSS. + +The design of the accordion makes it easy to implement, with all essential CSS styles already in place. This allows you to focus on integrating and using the component without worrying about additional styling. + +Complete example +---------------- + +Here is a complete example that demonstrates how to use the accordion Component in a Mautic template: + +.. code-block:: twig + + {% set utmTagsContent %} + {% for i, utmTag in form.utmTags %} + {{ form_row(utmTag) }} + {% endfor %} + {% endset %} + + {% include '@MauticCore/Helper/accordion.html.twig' with { + 'items': [ + { + 'id': 'UTM', + 'title': 'mautic.email.utm_tags', + 'padding_inline': false, + 'content': utmTagsContent, + } + ] + } %} + +For more complex structures, with dozens of accordion items, you might prefer to copy the structure and build something unique, but the best approach would be to place each content under a set block. \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index ca905300..25afa3d2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -56,7 +56,8 @@ There are several ways to support Mautic other than contributing with code. :caption: Design and UX :hidden: - design/retrieving_system_information + design/accordion + design/retrieving_system_settings .. toctree:: :maxdepth: 2