Skip to content

Conversation

@davidwebca
Copy link

@davidwebca davidwebca commented Sep 17, 2025

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.

Adresses #2282, #2984 and might invalidate #4547

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant