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

No styles for form elements #4

Closed
loicknuchel opened this issue Jan 1, 2022 · 6 comments
Closed

No styles for form elements #4

loicknuchel opened this issue Jan 1, 2022 · 6 comments

Comments

@loicknuchel
Copy link
Contributor

Hi, it's me again, still working on my tailwind migration for Azimutt ^^

This time I'm trying to implement some basic form but can't get the expected styles.
I take an example from https://tailwindui.com/components/application-ui/forms/input-groups but it seems I miss some styles.
I see that @tailwindcss/forms plugin is required but your readme says it's included.
I added Global.global Tw.globalStyles in my view, so not sure if I need other configuration.

Is there a known problem with forms?
Is the forms plugin really included ? Should I do something to include it?
Did I miss some configuration?
Do you have any idea how to fix/troubleshoot?

Thanks a lot for your help 👍

@matheus23
Copy link
Owner

Hi @loicknuchel 👋
Yeah, due to a limitation of elm-css (the root issue is that we don't have control over the order of CSS declarations that are generated) there's some differences in using the tailwindcss/forms plugin from the way it's used in tailwindui.
The tailwindcss/forms plugin has two modes it operates in: Either it adds some styling globally without having to add classes (the default one and the one used in tailwindui), or you configure it to only generate classes, but then you'll have to add more classes to your html (that's the only one we can support in elm-tailwind-modules).

Long story short, when you have e.g. an <input> element, you'll need to add the form-input class to it or when you have a <textarea> you need to add the form-textarea class.

In general, just look for form_* prefixed style definitions in elm-default-tailwind-modules. Those are likely the ones you need to sprinkle in here and there for the tailwindui stuff to work :)

@loicknuchel
Copy link
Contributor Author

Hey!

Awesome! Can't find them but indeed that's exactly what I was missing.
Maybe a small addition with this in the readme could help, and avoid potential other issues (even if I'm the only one for now ^^).

@matheus23
Copy link
Owner

Yeah an addition to the read me sounds like it'd help.
At some point I changed how the included tailwindcss/forms plugin was configured, but forgot to mention that in the readme.
I think you're the person who knows best what words would've helped you in the readme. Would you mind opening a PR with some suggested changes?

@loicknuchel
Copy link
Contributor Author

haha maybe ;)
Yes, will do the PR.

An other question while I'm on it, do you plan publish an update for tailwind 3? (I don't know if it's a lot of work or not)

@matheus23
Copy link
Owner

There's a discussion about that here: matheus23/elm-tailwind-modules#9

The short answer is: It's likely to be too much for me to work on right now :/

@loicknuchel
Copy link
Contributor Author

Thanks, I will follow the discussion there.

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

2 participants