@if
Display content based on dynamic conditions
Syntax
@if(condition)
<!-- Content shown when condition is true -->
@endif@if(condition)
<!-- Content for first condition -->
@elseif(otherCondition)
<!-- Content for second condition -->
@else
<!-- Fallback content -->
@endifBlock-Level Conditionals
Basic If Statement
If Not Statement
Multiple Conditions with Else If
Edit/Preview Mode Detection
Inline Conditionals
Dynamic Class Names
Multiple Conditional Classes
Conditional Attributes
Conditional Image Attributes
Conditional Visibility Styles
Nested Conditionals
Combining with @each
Common Patterns
Fallback Content
Feature Toggles
Conditional Includes
Best Practices
Related
Last updated
Was this helpful?

