Skip to content

Commit 56288a3

Browse files
authored
Remove input borders by default (#14929)
This PR reverts a change we made for v4 that added borders to inputs by default. It feels like we have to go further than this for this to actually be useful to anyone, and since there were no borders in v3 it's also a breaking change. If we wanted to make form elements look more "normal" out of the box I think we need to do something more like this: https://play.tailwindcss.com/icCwFLVp4z?file=css But it's a huge rabbit hole and there are so many stupid details to get right that it feels like an insurmountable task, and if we can't go all the way with it it's better to just maximize compatibility with v3. --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent bcddc81 commit 56288a3

File tree

8 files changed

+1
-609
lines changed

8 files changed

+1
-609
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6262
- Rename `--line-height-*` variables to `--leading-*` ([#14925](https://github.com/tailwindlabs/tailwindcss/pull/14925))
6363
- Revert specificity of `*` variant to match v3 behavior ([#14920](https://github.com/tailwindlabs/tailwindcss/pull/14920))
6464
- Replace `outline-none` with `outline-hidden`, add new simplified `outline-none` utility ([#14926](https://github.com/tailwindlabs/tailwindcss/pull/14926))
65+
- Revert adding borders by default to form inputs ([#14929](https://github.com/tailwindlabs/tailwindcss/pull/14929))
6566

6667
## [4.0.0-alpha.31] - 2024-10-29
6768

integrations/upgrade/index.test.ts

Lines changed: 0 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,6 @@ test(
133133
}
134134
}
135135
136-
/*
137-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
138-
added these compatibility styles to make sure everything still looks the
139-
same as it did with Tailwind CSS v3.
140-
141-
If we ever want to remove these styles, we need to add \`border-0\` to
142-
any form elements that shouldn't have a border.
143-
*/
144-
@layer base {
145-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
146-
select,
147-
textarea {
148-
border-width: 0;
149-
}
150-
}
151-
152136
@utility foo {
153137
color: red;
154138
}
@@ -240,22 +224,6 @@ test(
240224
}
241225
}
242226
243-
/*
244-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
245-
added these compatibility styles to make sure everything still looks the
246-
same as it did with Tailwind CSS v3.
247-
248-
If we ever want to remove these styles, we need to add \`border-0\` to
249-
any form elements that shouldn't have a border.
250-
*/
251-
@layer base {
252-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
253-
select,
254-
textarea {
255-
border-width: 0;
256-
}
257-
}
258-
259227
.btn {
260228
@apply tw:rounded-md! tw:px-2 tw:py-1 tw:bg-blue-500 tw:text-white;
261229
}
@@ -320,22 +288,6 @@ test(
320288
}
321289
}
322290
323-
/*
324-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
325-
added these compatibility styles to make sure everything still looks the
326-
same as it did with Tailwind CSS v3.
327-
328-
If we ever want to remove these styles, we need to add \`border-0\` to
329-
any form elements that shouldn't have a border.
330-
*/
331-
@layer base {
332-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
333-
select,
334-
textarea {
335-
border-width: 0;
336-
}
337-
}
338-
339291
.a {
340292
@apply flex;
341293
}
@@ -408,22 +360,6 @@ test(
408360
}
409361
}
410362
411-
/*
412-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
413-
added these compatibility styles to make sure everything still looks the
414-
same as it did with Tailwind CSS v3.
415-
416-
If we ever want to remove these styles, we need to add \`border-0\` to
417-
any form elements that shouldn't have a border.
418-
*/
419-
@layer base {
420-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
421-
select,
422-
textarea {
423-
border-width: 0;
424-
}
425-
}
426-
427363
@layer base {
428364
html {
429365
color: #333;
@@ -501,22 +437,6 @@ test(
501437
}
502438
}
503439
504-
/*
505-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
506-
added these compatibility styles to make sure everything still looks the
507-
same as it did with Tailwind CSS v3.
508-
509-
If we ever want to remove these styles, we need to add \`border-0\` to
510-
any form elements that shouldn't have a border.
511-
*/
512-
@layer base {
513-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
514-
select,
515-
textarea {
516-
border-width: 0;
517-
}
518-
}
519-
520440
@utility btn {
521441
@apply rounded-md px-2 py-1 bg-blue-500 text-white;
522442
}
@@ -1002,22 +922,6 @@ test(
1002922
}
1003923
}
1004924
1005-
/*
1006-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1007-
added these compatibility styles to make sure everything still looks the
1008-
same as it did with Tailwind CSS v3.
1009-
1010-
If we ever want to remove these styles, we need to add \`border-0\` to
1011-
any form elements that shouldn't have a border.
1012-
*/
1013-
@layer base {
1014-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1015-
select,
1016-
textarea {
1017-
border-width: 0;
1018-
}
1019-
}
1020-
1021925
--- ./src/utilities.css ---
1022926
@utility no-scrollbar {
1023927
&::-webkit-scrollbar {
@@ -1442,22 +1346,6 @@ test(
14421346
}
14431347
}
14441348
1445-
/*
1446-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1447-
added these compatibility styles to make sure everything still looks the
1448-
same as it did with Tailwind CSS v3.
1449-
1450-
If we ever want to remove these styles, we need to add \`border-0\` to
1451-
any form elements that shouldn't have a border.
1452-
*/
1453-
@layer base {
1454-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1455-
select,
1456-
textarea {
1457-
border-width: 0;
1458-
}
1459-
}
1460-
14611349
--- ./src/root.2.css ---
14621350
/* Already contains @config */
14631351
@import 'tailwindcss';
@@ -1482,22 +1370,6 @@ test(
14821370
}
14831371
}
14841372
1485-
/*
1486-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1487-
added these compatibility styles to make sure everything still looks the
1488-
same as it did with Tailwind CSS v3.
1489-
1490-
If we ever want to remove these styles, we need to add \`border-0\` to
1491-
any form elements that shouldn't have a border.
1492-
*/
1493-
@layer base {
1494-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1495-
select,
1496-
textarea {
1497-
border-width: 0;
1498-
}
1499-
}
1500-
15011373
--- ./src/root.3.css ---
15021374
/* Inject missing @config above first @theme */
15031375
@import 'tailwindcss';
@@ -1532,22 +1404,6 @@ test(
15321404
}
15331405
}
15341406
1535-
/*
1536-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1537-
added these compatibility styles to make sure everything still looks the
1538-
same as it did with Tailwind CSS v3.
1539-
1540-
If we ever want to remove these styles, we need to add \`border-0\` to
1541-
any form elements that shouldn't have a border.
1542-
*/
1543-
@layer base {
1544-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1545-
select,
1546-
textarea {
1547-
border-width: 0;
1548-
}
1549-
}
1550-
15511407
--- ./src/root.4.css ---
15521408
/* Inject missing @config due to nested imports with tailwind imports */
15531409
@import './root.4/base.css';
@@ -1580,22 +1436,6 @@ test(
15801436
}
15811437
}
15821438
1583-
/*
1584-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1585-
added these compatibility styles to make sure everything still looks the
1586-
same as it did with Tailwind CSS v3.
1587-
1588-
If we ever want to remove these styles, we need to add \`border-0\` to
1589-
any form elements that shouldn't have a border.
1590-
*/
1591-
@layer base {
1592-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1593-
select,
1594-
textarea {
1595-
border-width: 0;
1596-
}
1597-
}
1598-
15991439
--- ./src/root.4/utilities.css ---
16001440
@import 'tailwindcss/utilities' layer(utilities);
16011441
@@ -1622,22 +1462,6 @@ test(
16221462
border-color: var(--color-gray-200, currentColor);
16231463
}
16241464
}
1625-
1626-
/*
1627-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1628-
added these compatibility styles to make sure everything still looks the
1629-
same as it did with Tailwind CSS v3.
1630-
1631-
If we ever want to remove these styles, we need to add \`border-0\` to
1632-
any form elements that shouldn't have a border.
1633-
*/
1634-
@layer base {
1635-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1636-
select,
1637-
textarea {
1638-
border-width: 0;
1639-
}
1640-
}
16411465
"
16421466
`)
16431467
},
@@ -1696,22 +1520,6 @@ test(
16961520
}
16971521
}
16981522
1699-
/*
1700-
Form elements have a 1px border by default in Tailwind CSS v4, so we've
1701-
added these compatibility styles to make sure everything still looks the
1702-
same as it did with Tailwind CSS v3.
1703-
1704-
If we ever want to remove these styles, we need to add \`border-0\` to
1705-
any form elements that shouldn't have a border.
1706-
*/
1707-
@layer base {
1708-
input:where(:not([type='button'], [type='reset'], [type='submit'])),
1709-
select,
1710-
textarea {
1711-
border-width: 0;
1712-
}
1713-
}
1714-
17151523
--- ./src/styles/components.css ---
17161524
.btn {
17171525
@apply bg-black px-4 py-2 rounded-md text-white font-medium hover:bg-zinc-800;

0 commit comments

Comments
 (0)