🎨x-bind:class

Overview

Bind a class to an element based on an expression

Example

<style>
.bg-violet {
    background-color: '#7c3aed'
}
</style>

<div x-bind:class="bg-violet if your_condition">

Last updated