Skip to content

support ux components  #173

@tacman

Description

@tacman

I'm a huge fan of Symfony UX Components, and greatly prefer them to macros. I think it's worth considering supporting them in this bundle as well.

In addition to not needing the import, I find the syntax cleaner, and of course the big benefit is that you can inject services, like security. Plus, setting defaults and handling logic is easier in PHP than in Twig.

// using macros
{% from '@Tabler/components/alert.html.twig' import alert %}
{{ alert({title : 'Title V2', description: 'Description V2', icon : 'warning', dismissible : true}) }}

// using a component
<twig:alert title="Title V2" description="Description" icon='warning' dismissable="true" />

{# Since often the data passed to the component is dynamic, it's even shorter, from a different theme bundle  #}

                    {% for bsClass in bootstrap_theme_colors() %}
                        {% set message ="Look, a %s alert — check it out!"|format(bsClass)   %}
                        <twig:alert :message="message" :type="bsClass" />
                    {% endfor %}

There's a lot of power in the UX components, I have a whole set of them that I wrote for the sneat theme that would likely port pretty easily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureFeature requestedStatus: ReviewedHas staff reply/investigation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions