-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x-show not working in conjunction with flex #791
Comments
Setting |
OK, it seems tailwind proposes important as standard. x-show works if that important flag is set to false |
That's not actually true. By default, Tailwind won't use |
Have there been any thoughts about using a property instead of inline styles, like for |
Same here with Bulma CSS... if I put "is-flex" class, the div is not hidden |
Could you share the It's always been my understanding that inline-styles have higher precedence styles from a CSS file |
@HugoDF That is the case, unless you use .is-flex {
display: flex !important;
} |
I mean the workarounds would be:
|
I solved it using a parent element: <div x-show="!files.length">
<div class="is-flex is-justify-content-center">
<p class="help has-text-grey">Not found</p>
</div>
</div> It can also work as it says @HugoDF <div :class="{'is-justify-content-center': true, 'is-flex': !files.length}" x-show="!files.length">
<p class="help has-text-grey">Not found</p>
</div> or also <div :class="{'is-hidden': files.length, 'is-flex is-justify-content-center': !files.length}">
<p class="help has-text-grey">Not found</p>
</div> |
I also think that |
you can deactivate the !important setting in tailwind
… Le 24 mars 2021 à 11:58, Bogdan Kondratov ***@***.***> a écrit :
I also think that !important on the display: none toggled by x-show is, well, important. At least there should be an option to add it. Specifically to avoid gross workarounds with Tailwind - it uses !important on utility classes to override base styles, third-party styles and Tailwind's extracted components styling.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#791 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB4E6QAVKV3HG3ZAD5QO25LTFHAWLANCNFSM4R4KMX3Q>.
|
|
It is even disabled by default. It is quite useful though, that's why it's often enabled in projects. |
Right now the most elegant workaround, in case anybody is facing the same issue with Alpine and Tailwind goes something like this:
Edit: This isn't a proper workaround because it messes |
Hi! First I'd like to thank the creators and contributors of these two amazing libs and frameworks. Tailwindcss and AlpineJs are awesome ❤️ Then I'd like to second the option to have As a specific workaround I successfully tried and set Tailwind's important flag on every selector not matching the x-show directive : module.exports = {
...
important: ':not([x-show])',
...
} This has the benefit to allow x-show directive to override flex display and have its transitions applied. |
Thanks for bringing this back up. I agree this needs to be addressed. I think I will add !important to x-show in v3. Is there any downside to doing this? |
I don't see any downside, as the x-show directive should have the final word regarding display (none) of the element. And this is the only style rule affected by the directive. @calebporzio what's your status re:v3, is it something you plan to release in a few weeks or more like end of the year ? |
Personally I'd much prefer the option of using a property or class for applying the |
@jcasanova , thanks for the input. In a few weeks! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Suggesting to change the style attribute to
display:none !important
Without the !important flag, situations occur when the content is displayed, even when condition is falsy
The text was updated successfully, but these errors were encountered: