Changing the width of an element based on the value of a react variable #4431
-
Hi I'm trying to create a progress bar for audio playback. I have the following code that shows the inside progress color when the width is set statically
With dynamic progress width
I tried to set the width to be based on a state variable that changes based on |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@cordobadigitalmedia This is probably not working because of your purge settings. So because you don't explicitly have However, here it is a lot easier if you use inline style: <div className="bg-lime-500 ..." style={{width: `${currentTime}px`}} |
Beta Was this translation helpful? Give feedback.
@cordobadigitalmedia This is probably not working because of your purge settings. So because you don't explicitly have
w-2 w-4 ...
in your file, these classes are not generated (if mode = JIT) or being removed (if mode != JIT).See here for more details.
However, here it is a lot easier if you use inline style: