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

Padding and alignments of buttons, etc are weird when using styled + tailwind #34

Open
elburro1887 opened this issue Jul 29, 2024 · 5 comments

Comments

@elburro1887
Copy link

elburro1887 commented Jul 29, 2024

When using Prime React with Styled + Tailwind options (Vite and Nextjs, for example), the padding on the button and the alignment of the icons/ other components is different than what is shown on the documentation page.

When using the original values in vite-styled-tailwind/src/index.css:

font-size: 16px;
line-height: 24px;

The button and the input field have excessive padding, the icon in the cutton is too low, radio buttons look normal.

Screenshot 2024-07-30 at 00 21 33

Now I change the values in in vite-styled-tailwind/src/index.css:

font-size: 14px;
line-height: 18px;

to match font size: 14px used the Button Component documentation page (https://primereact.org/button/). line-height is not used there, interestingly enough.

As one can see, the buttons look different, also the alignment of the radio buttons and the icon inside the button is off:

Screenshot 2024-07-30 at 00 23 37

There seems to be some issue here where Tailwind is interfering with the layout, can anyone help out? Thanks.

@melloware
Copy link
Member

Yeah this is tricky with Tailwind + Styled mode. There are lots of conflicting CSS I am sure.

@elburro1887
Copy link
Author

What would you suggest? Should I remove Tailwind altogether, or use Unstyled mode?

@melloware
Copy link
Member

melloware commented Jul 30, 2024

well you might be able to debug it and see what is causing the padding issues and recommend a fix to PrimeReact.

If you need TailWind use Tailwind. I use PrimeReact with just a PR theme without Tailwind.

@amurilo
Copy link
Contributor

amurilo commented Aug 15, 2024

Can you provide a stackblitz so I can take a look on the problem?

@elburro1887
Copy link
Author

elburro1887 commented Aug 16, 2024

The code I tested is the one from this folder in the repo:
https://github.com/primefaces/primereact-examples/tree/main/vite-unstyled-tailwind

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

3 participants