When and How to Use @class Blade Directive in Laravel
Hello artisan, in this laravel blade conditional class tutorial i am going to discuss about laravel @class blade directive. This
@class directive conditionally compiles a CSS class string. For example, in Blade templates, if you want to add HTML classes conditionally, then you can do this by using the @
class blade directive.
@class directive accepts an array of classes where the array key contains the class or classes we wish to add, while the value has to be boolean expression. See the example:
false. So it removes
font-bold class from the HTML attributes. the
class() would only include the
font-bold class when the
true. Hope it can help you.