Different units and dynamic variable values#4677
Open
davidwebca wants to merge 1 commit intoalpinejs:mainfrom
Open
Different units and dynamic variable values#4677davidwebca wants to merge 1 commit intoalpinejs:mainfrom
davidwebca wants to merge 1 commit intoalpinejs:mainfrom
Conversation
I extended the functionality of the existing collapse plugin to allow using any known CSS unit or any CSS variable.
Ex.:
```x-collapse.min.var(--collapse-min)``` will now work.
```x-collapse.min.100lvh``` will now work.
```x-collapse.min.100``` still fallbacks to pixels.
The variable detection hence allows Tailwind to set arbitrary values to variables with responsive variants.
```
<div class="[--collapse-min:100px] lg:[--collapse-min:500px]" x-collapse.min.var(--collapse-min)>
Example content
</div>
```
The example above allows us to set a minimum height to 100px on mobile and to 500px on desktop (lg screen size in Tailwind).
Maybe issue? : parentheses aren't technically in the spec for HTML attributes, but supported in all major browsers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I extended the functionality of the existing collapse plugin to allow using any known CSS unit or any CSS variable.
Ex.:
x-collapse.min.var(--collapse-min)will now work.x-collapse.min.100lvhwill now work.x-collapse.min.100still fallbacks to pixels.The variable detection hence allows Tailwind to set arbitrary values to variables with responsive variants.
The example above allows us to set a minimum height to 100px on mobile and to 500px on desktop (lg screen size in Tailwind).
Maybe issue? : parentheses aren't technically in the spec for HTML attributes, but supported in all major browsers.
Adresses #2282, #2984 and might invalidate #4547