Possible to change class name dynamically (from database)

Hi,

I have a repeat that displays styled cards for each record from the DB.

I would like to change the class name to alter the styling of each card based on the class name returned in the same record from the database.

E.g.

DBQuery: name, location, class_toggle

Currently using the Dynamic Attribute Class Toggle feature does not allow insertion of dynamic data into the 'Name' field.

Has anyone achieved this by coding this manually that works with Wappler?

Thanks

This can be done by adding multiple Class Toggles as in

<h1 dmx-class:text-primary="{{blue}}" dmx-class:text-danger="{{red}}">Fancy display heading</h1>

You can use:

dmx-bind:class="dynamic_expression"
2 Likes