Using props does not work
See original GitHub issueGiven the following code
const TimelineCurrent = tw.div<{ position: number }>`
absolute
left-0
top-[0.575rem]
${(p) => `w-[calc(${p.position}%-0.75rem)]`}
h-[0.35rem]
`;
it renders the following HTML
<div position="100" class="absolute left-0 top-[0.575rem] w-[calc(100%-0.75rem)] h-[0.35rem]"></div>
But the w-[calc(100%-0.75rem)] part is not picked up by Tailwind JIT, so it has no effect. Am I doing something wrong here?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React: Passing Props not working. What am I missing?
All you have to do is change up how you set it up on App. Props need to be passed on the tag,...
Read more >How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >passing children via props does not work properly on React ...
The way to pass children in a .astro file is via the content, not props. Once you're in a React component you pass...
Read more >How to use Props in React - Robin Wieruch
Everything you need to know about props in React. How to pass props to components, how to set default props, how to know...
Read more >How to Use Props in React - freeCodeCamp
In this tutorial, we'll talk about an important concept in React – props. I'll show you how to use them to keep the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

JIT runs at build time, but your class name gets computed at runtime… Hence, tailwind does not know the actual name of the class at build time and cannot generate the CSS for it.
@azzlack that’s not an issue. You wrote the calc css syntax wrong.
calc(100%-0.75rem)will not work even with css. You should add a space around the-operator. Like thiscalc(100% - 0.75rem). With tailwind spaces inside custom classes should be marked with_so your final class should bew-[calc(100%_-_0.75rem)].