[Tailwind v4] Fully Dynamic Class Names from Server-Side Data Not Applied at Runtime #18135
krishnamk-2604
started this conversation in
Ideas
Replies: 1 comment
-
Related: #18137 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
We are dynamically injecting utility class names from the server side. For example, the server returns:
This is applied in the component like so:
Observed Behavior
The combined class string renders correctly in the DOM:
class="space-y-8 md:space-y-12 lg:space-y-14 my-4 sm:my-5 md:my-8 lg:my-10"
However, styles from the dynamically injected classes (my-4, sm:my-5, etc.) are not applied. The base and statically coded classes work correctly. The values are unpredictable, user-configured, and cannot be feasibly safelisted. and is not practical due to unpredictable nature of the data (e.g., hundreds of possible permutations).
Beta Was this translation helpful? Give feedback.
All reactions