Skip to content

Commit

Permalink
Add placeholder variant (#6106)
Browse files Browse the repository at this point in the history
* add `placeholder` variant

* update changelog
  • Loading branch information
RobinMalfait committed Nov 16, 2021
1 parent 85320c2 commit 6c4b86d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,10 @@ Nothing yet!

- Enforce the order of some variants (like `before` and `after`) ([#6018](https://github.com/tailwindlabs/tailwindcss/pull/6018))

### Added

- Add `placeholder` variant ([#6106](https://github.com/tailwindlabs/tailwindcss/pull/6106))

## [3.0.0-alpha.2] - 2021-11-08

### Changed
Expand Down
2 changes: 2 additions & 0 deletions src/corePlugins.js
Expand Up @@ -23,6 +23,8 @@ export let variantPlugins = {

addVariant('file', '&::file-selector-button')

addVariant('placeholder', '&::placeholder')

addVariant('before', ({ container }) => {
container.walkRules((rule) => {
let foundContent = false
Expand Down
7 changes: 7 additions & 0 deletions tests/variants.test.css
Expand Up @@ -165,6 +165,13 @@
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
.placeholder\:font-bold::placeholder {
font-weight: 700;
}
.placeholder\:text-red-500::placeholder {
--tw-text-opacity: 1;
color: rgb(239 68 68 / var(--tw-text-opacity));
}
.before\:block::before {
content: var(--tw-content);
display: block;
Expand Down
1 change: 1 addition & 0 deletions tests/variants.test.html
Expand Up @@ -49,6 +49,7 @@
<div class="file:bg-blue-500 file:text-white"></div>
<div class="before:block before:bg-red-500"></div>
<div class="after:flex after:uppercase"></div>
<div class="placeholder:font-bold placeholder:text-red-500"></div>

<!-- Group variants -->
<div class="group-open:bg-red-200"></div>
Expand Down

0 comments on commit 6c4b86d

Please sign in to comment.