Optional TypewindProvider, strict mode, aliases & more #68
vishnudt2004
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! 👋
I’ve been using
typewindrecently and really enjoying its API, the DX is so clean and modern.While experimenting, I came up with a few ideas for potential features/enhancements that could push
typewindeven further. I realize not all of them may align with the core philosophy, but I wanted to share them in case any seem useful or worth exploring:💡 Feature Ideas:
twProp SupportAllow using a
twprop on any JSX element as an alternative toclassName. This could help clearly distinguish Tailwind styles from custom class names, leading to cleaner codebases.Alias Support (Component-Level or Config-Based)
Similar to how Tailwind supports
@apply,typewindcould support a lightweight alias system:Either through a config file or within a Provider (explained below).
Strict Mode
A mode where
typewindlogs warnings (or errors) if raw stringclassNamesare used instead of thetwprop. This could be helpful during migrations or when enforcing code consistency.<TypewindProvider>ComponentA React Provider that enables app-wide configuration of
typewindbehavior. For example:Features like aliasing, logging, strict mode, etc., could all be controlled via props.
Dedicated
typewind.config.jsFileInstead of using
package.jsonfor config, allow a separate config file for better structure and flexibility — similar totailwind.config.js..twFile Support (Optional Future)Explore the idea of using
.twfiles to define reusable sets of Tailwind styles — especially helpful in large apps where styles get complex and repetitive.I totally understand if some of these ideas go beyond the intended scope of
typewind. But I believe even a few of these could enhance its flexibility and developer experience.I also feel like some of these might be overkill or not really necessary. I’m just sharing all the ideas that came to mind suddenly while experimenting.
I’d also love to contribute to some of these ideas — maybe not full implementations, but I’m happy to initiate or collaborate on them wherever possible.
Thanks for building such a great tool! 🤝
Edit: After some deeper research, I've realized that what I proposed isn't actually feasible, custom props like
twcan't be used directly on native JSX elements like<h1>or<p>, as React strips unknown props from DOM output for safety reasons. So yeah, I acknowledge this was a mistaken suggestion on my part.Beta Was this translation helpful? Give feedback.
All reactions