Conditional CSS Class on Element
AndrewMarkUK opened this issue · comments
Hi
This is more of a question that an issue. hope its OK for me to write it here.
I am wishing to include a conditional css within an element tag but wondering the best way to do this, for example say I have:
After a number of attempts of different methods (that did not work) I came up with this...BUT, I don't think it is ideal...
<check if="@Columns == '8'"> <true> <div class="row row-cols-1 g-3 mb-3 pt-3"> </true> <false> <div class="row row-cols-1 row-cols-md-3 g-3 mb-3 pt-3"> </false> </check>
We can see from true I am removing 'row-cols-md-3'
But a method from within the tag would perhaps be better?
Anyone done this?
You can simplify this with a ternary condition:
<div class="row row-cols-1 {{ @Columns==8 ? '' : 'row-cols-md-3' }} g-3 mb-3 pt-3">
! the one things I did not try 👍
Thank you