tailwindlabs / tailwindcss-forms

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.
https://tailwindcss-forms.vercel.app
MIT License
4.22k stars 223 forks source link

Allow for <input> without `type` #140

Closed karlhorky closed 1 year ago

karlhorky commented 1 year ago

Allow for <input /> elements without the type attribute (eg. which defaults to a text input), which may be required by certain codebases:

<input /> <!-- same as input with type="text" -->

Also removed the note from the readme, which isn't required anymore if my approach works

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-forms ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 13, 2023 0:35am
adamwathan commented 1 year ago

Hey thanks! This solution won't work as :not([type]) will match just about every single element in your project. Every div, span, nav, header, etc. will all get the input styles.

Take a look at the deployment preview this PR creates for instance:

https://tailwindcss-forms-git-fork-karlhorky-patch-1-tailwindlabs.vercel.app/

So going to close this one, but if you want to contribute a different solution I'm happy to take a look, just make sure you actually test it 👍🏻

karlhorky commented 1 year ago

@adamwathan Ok, thanks for the note. I wanted to open a quick PR for feedback first (I assumed that all of these selectors were already scoped to input elements), but I guess just adding the input to the selector is the answer? New PR: