Skip to content

Commit 6c4b86d

Browse files
authored
Add placeholder variant (tailwindlabs#6106)
* add `placeholder` variant * update changelog
1 parent 85320c2 commit 6c4b86d

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Nothing yet!
1313

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

16+
### Added
17+
18+
- Add `placeholder` variant ([#6106](https://github.com/tailwindlabs/tailwindcss/pull/6106))
19+
1620
## [3.0.0-alpha.2] - 2021-11-08
1721

1822
### Changed

src/corePlugins.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export let variantPlugins = {
2323

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

26+
addVariant('placeholder', '&::placeholder')
27+
2628
addVariant('before', ({ container }) => {
2729
container.walkRules((rule) => {
2830
let foundContent = false

tests/variants.test.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@
165165
--tw-text-opacity: 1;
166166
color: rgb(255 255 255 / var(--tw-text-opacity));
167167
}
168+
.placeholder\:font-bold::placeholder {
169+
font-weight: 700;
170+
}
171+
.placeholder\:text-red-500::placeholder {
172+
--tw-text-opacity: 1;
173+
color: rgb(239 68 68 / var(--tw-text-opacity));
174+
}
168175
.before\:block::before {
169176
content: var(--tw-content);
170177
display: block;

tests/variants.test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<div class="file:bg-blue-500 file:text-white"></div>
5050
<div class="before:block before:bg-red-500"></div>
5151
<div class="after:flex after:uppercase"></div>
52+
<div class="placeholder:font-bold placeholder:text-red-500"></div>
5253

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

0 commit comments

Comments
 (0)