Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize in tailwind.config.js #33

Closed
Kixell-NicolasJardillier opened this issue Jan 3, 2021 · 5 comments
Closed

How to customize in tailwind.config.js #33

Kixell-NicolasJardillier opened this issue Jan 3, 2021 · 5 comments

Comments

@Kixell-NicolasJardillier

Hi,

how to customize borders (width, colors, ...) of inputs with tailwind.config.js ?

Best regards

@Manubi
Copy link

Manubi commented Jan 9, 2021

Hi,
some of the stuff works. Some doesn't. Looking forward to get a small documenation as it would allow much faster development. It's the part wirth customForms. But it only works if you keep the form-input in your className as from the old package. https://tailwindcss-custom-forms.netlify.app/

CleanShot 2021-01-10 at 00 38 40@2x

@SaberOuarezzamen
Copy link

Hi,
First, I've tried cstuomForms it didn't work, apparently it's an old version or even an other package.
If you want to customize borders (width, colors, ...) of inputs on focus, use ring utilities : ring-color, ring-width

@yurirnascimento
Copy link

Hi,

As the plugin is now, it looks like we are limited to customizing directly in the element's class, or creating a css file and importing it as a component of our tailwind.css.

Example:
'border-color': theme('colors.gray.500', colors.gray[500]),

In order to be able to customize directly by tailwind.config.js it would be necessary to change to:
'border-color': theme('customForms.input.borderColor', colors.gray[500]),

But as I mentioned earlier, it can be customized by a css file.

forms.css
input[type='text'] { @apply border-gray-300; }

Note that I added input to the selector this is to work because of the css Precedence order. If it were a selector without the input, the style would not work.

And to the tailwind.css
@tailwind base; @tailwind components; @import "form.css"; @tailwind utilities;

For more info what selector you need to change, see the source.

@adamwathan
Copy link
Member

Hey! The recommended way to customize things using this plugin is to just write CSS. Act like the styles in this plugin are just part of Normalize/Preflight, and layer on any additional custom base styles you want to tweak the default styles 👍

@layer base {
  [type="text"],
  [type="email"]
  /* ... */ {
    border-color: pink;
  }

  /* ... */
}

Hope that helps!

shaun-technovation added a commit to Iridescent-CM/technovation-app that referenced this issue Dec 7, 2021
We're using the official Tailwind forms plugin now. These "base
form" styles will add onto what Tailwind gives us, the idea is that
these styles will get applied globally. If we need to add further
customizations (not globally) then they should be in another stylesheet
related to where it's being used, if that makes sense. Only global form
style changes should go in here.

For reference, following the pattern here:
tailwindlabs/tailwindcss-forms#33 (comment)

Refs: #3128
shaun-technovation added a commit to Iridescent-CM/technovation-app that referenced this issue Dec 7, 2021
We're using the official Tailwind forms plugin now. These "base
form" styles will add onto what Tailwind gives us, the idea is that
these styles will get applied globally. If we need to add further
customizations (not globally) then they should be in another stylesheet
related to where it's being used, if that makes sense. Only global form
style changes should go in here.

For reference, following the pattern here:
tailwindlabs/tailwindcss-forms#33 (comment)

Refs: #3128
shaun-technovation added a commit to Iridescent-CM/technovation-app that referenced this issue Dec 7, 2021
We're using the official Tailwind forms plugin now. These "base
form" styles will add onto what Tailwind gives us, the idea is that
these styles will get applied globally. If we need to add further
customizations (not globally) then they should be in another stylesheet
related to where it's being used, if that makes sense. Only global form
style changes should go in here.

For reference, following the pattern here:
tailwindlabs/tailwindcss-forms#33 (comment)

Refs: #3128
@Muffinman
Copy link

My solution was just to copy the plugin into my own project and then remove all the hard coded references. Not great.

I don't like the idea of mixing tailwind and plain CSS just for this, when I've not had to add any custom CSS for any other reason.

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

No branches or pull requests

6 participants