Skip to content
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

Add [open] variant #5627

Merged
merged 2 commits into from
Sep 28, 2021
Merged

Add [open] variant #5627

merged 2 commits into from
Sep 28, 2021

Conversation

reinink
Copy link
Member

@reinink reinink commented Sep 28, 2021

This PR adds a new [open] attribute selector variant to Tailwind CSS. This is based on the work started by @seanpdoyle in #4627. This can be useful for applying styles to <details> or <dialog> elements based on whether they are open.

<details class="border-0 open:border-1" open>
  <!-- ... -->
</details>

<details class="border-0 open:border-1">
  <!-- ... -->
</details>

This can also be combined with group and peer variants:

<details class="group peer" open>
  <summary>
    <span class="hidden group-open:inline">Close me, I'm open</span>
    <span class="inline group-open:hidden">Open me, I'm closed</span>
  </summary>
</details>

<span class="hidden peer-open:inline">I'm next to an open element</span>
<span class="inline peer-open:hidden">I'm next to a closed element</span>

Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-Authored-By: Sean Doyle <2575027+seanpdoyle@users.noreply.github.com>
@reinink reinink mentioned this pull request Sep 28, 2021
This function replaces the existing `applyPseudoToMarker()` and `applyAttributeToMarker()` functions.

Co-Authored-By: Robin Malfait <1834413+RobinMalfait@users.noreply.github.com>
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.

None yet

1 participant