This is the documentation for
v1 but the latest version is
v3
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-html
The class() helper
The class method on Html is a helper to render a class attribute similar to Vue.js' :class property.
It expects an array (or a Collection), and will toggle a set of classes depending on the values of the array.
If there's just a value (non-associative), the class will always be added. Otherwise, the class—specified by the array key—will only appear in the list if the value evaluates to true (non-strict).