Skip to content

Conversation

@josercarmo
Copy link

@josercarmo josercarmo commented Dec 14, 2019

Based off the work down for first-child and last-child variants this PR adds new only-child variant to the framework, but disabled by default for all core plugins.

Just like the first-child, last-child PR these pseudo selectors effect the element itself not the children of the element.

Ex:

<body>
  <h1 class="text-2xl font-bold text-center invisible only:visible">Create your first Todo!</h1>
</body>

Ex:

<body>
  <div>
	<h1 class="hidden only:inline-block" >None items yet! Create one now!</h1>
	{todos.map(todo => <p>{todo}</p>)}
 </div>
</body>

@hacknug
Copy link
Contributor

hacknug commented Dec 19, 2019

I feel like using only as the variant name isn't a good idea since this might refer to both :only-child and :only-of-type. I might also add support for the latter since that could also be helpful. If not for core, maybe build a plugin adding support for them 👍

@josercarmo
Copy link
Author

@hacknug, last and first variants have the same "issue" and was created like this, I just followed the pattern.

@hacknug
Copy link
Contributor

hacknug commented Dec 21, 2019

True, didn't thought about that. I guess it's not that important if at least it's consistent with the ones you mentioned. Thanks for clarifying 🙌

@rhukster
Copy link

rhukster commented Feb 2, 2020

Ran into this yesterday, noticed this one was missing...

@adamwathan
Copy link
Member

Hey thanks for the PR! Going to say no on adding this to core right now, but if there is overwhelming demand for it in the future we can revisit it.

In the mean time you can add this to your own projects by writing a plugin:

https://tailwindcss.com/docs/plugins/

@adamwathan adamwathan closed this Jul 8, 2020
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.

4 participants