Replies: 2 comments
-
I support the idea of removing Because we own the components we can work around any styling issues in any way that we want, that's the whole point. Perhaps even omit |
Beta Was this translation helpful? Give feedback.
-
Using |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm using
shadcn/ui
and I'm really happy. I love to own the components and change the styles from time to time, but still save time and have beautiful styles as default.I want to suggest an option to use
shadcn/ui
without exposing theclassName
prop (and withouttailwind-merge
).When I create UI components I don't expose
className
property - so other usages of the component won't be able to override classes.Instead of using 'className
- I add a variant to the component or use a wrapper element with
classNameto change the layout and positioning. Adding
classNameto the component makes the code less robust and more error-prone. I also think that it's better to remove tailwind-merge - because of this. Instead, I use css values that do not have collision (and if so - it's a different variant). What do you think? Is it possible to create a flag of shadcn/ui without exposing className or without using
tailwind-merge`?Those changes make the components more robust to css changes.
BTW - removing tailwind-merge can save some kb in the bundle too.
WDYT?
EDIT: tailwind-merge also write about the drawbacks of exposing
className
in their documentation https://github.com/dcastil/tailwind-merge/blob/v2.2.0/docs/when-and-how-to-use-it.md#more-difficult-to-refactor-highly-reusable-componentsBeta Was this translation helpful? Give feedback.
All reactions