Implement the data-wp-if directive #65956
Closed
giuliodelmastro
started this conversation in
Interactivity API
Replies: 1 comment
-
|
Closing this discussion to centralize the conversation in this other one: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys.
It would be useful to be able to have a directive like “x-if” in AlpineJS, where the element is rendered only if the condition in the attribute is true.
You can use “data-wp-bind--hidden” hides only the element in the dom rendering it anyway.
Also, “data-wp-bind” does not support comparison operations and wants the boolean value directly. e.g:
❌ data-wp-bind--hidden="context.day < 1”
A directive like “data-wp-if” would make it much easier to develop components, even the most complex ones.
Beta Was this translation helpful? Give feedback.
All reactions