Replies: 22 comments 8 replies
-
Setting |
Beta Was this translation helpful? Give feedback.
-
OK, it seems tailwind proposes important as standard. x-show works if that important flag is set to false |
Beta Was this translation helpful? Give feedback.
-
That's not actually true. By default, Tailwind won't use |
Beta Was this translation helpful? Give feedback.
-
Have there been any thoughts about using a property instead of inline styles, like for |
Beta Was this translation helpful? Give feedback.
-
Same here with Bulma CSS... if I put "is-flex" class, the div is not hidden |
Beta Was this translation helpful? Give feedback.
-
Could you share the It's always been my understanding that inline-styles have higher precedence styles from a CSS file |
Beta Was this translation helpful? Give feedback.
-
@HugoDF That is the case, unless you use .is-flex {
display: flex !important;
} |
Beta Was this translation helpful? Give feedback.
-
I mean the workarounds would be:
|
Beta Was this translation helpful? Give feedback.
-
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> |
Beta Was this translation helpful? Give feedback.
-
I also think that |
Beta Was this translation helpful? Give feedback.
-
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>.
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
It is even disabled by default. It is quite useful though, that's why it's often enabled in projects. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
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 ? |
Beta Was this translation helpful? Give feedback.
-
Personally I'd much prefer the option of using a property or class for applying the |
Beta Was this translation helpful? Give feedback.
-
@jcasanova , thanks for the input. In a few weeks! |
Beta Was this translation helpful? Give feedback.
-
If anyone is still having this issue, Tailwind now provides a suitable workaround: TLDR:
And add This effectively increases the CSS selector specificity on Tailwind utilities, but inline classes still override it. |
Beta Was this translation helpful? Give feedback.
-
I stumbled upon this today. Would it make sense to provide a modifier for this? I don't think this should be dependent on setting Using If possible I'd like to use |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions