-
-
Notifications
You must be signed in to change notification settings - Fork 328
Does IDOM support CSS modules? #478
-
I was reading up about React and was wondering if IDOM has an integrated way of implementing CSS modules.
Beta Was this translation helpful? Give feedback.
All reactions
You can add style to elements in two ways:
- with a
styletag element - using the
styleprop (as in React)
# style element (write a CSS string) html.style(".some-css {...}") # define style the same as React with a camelCased dict html.div({"style": {"backgroundColor": "red"})
Replies: 2 comments 5 replies
-
You can add style to elements in two ways:
- with a
styletag element - using the
styleprop (as in React)
# style element (write a CSS string) html.style(".some-css {...}") # define style the same as React with a camelCased dict html.div({"style": {"backgroundColor": "red"})
Beta Was this translation helpful? Give feedback.
All reactions
-
Can style be updated with hooked variables?
For example:
bgstate, set_bgstate = idom.hooks.use_state("red") html.div({"style": {"backgroundColor": bgstate})
I've tried this and can't get it to work. It will start red but when calling set_bgstate() it doesn't change.
Any tips?
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1 -
👀 1
-
Yup that's a bug. That's probably also why the snake game from the examples is broken right now too.
Beta Was this translation helpful? Give feedback.
All reactions
-
Tracking it here: #480
Beta Was this translation helpful? Give feedback.
All reactions
-
@jgburford without that little hint it would have taken me ages to debug the underlying issue. Thanks! 🙏
Beta Was this translation helpful? Give feedback.
All reactions
-
@rmorshea glad I could be of some help!
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't think it's technologically possible for IDOM to have scoped CSS, such as with css-modules.
The only viable solution is inline styles, as mentioned above
Beta Was this translation helpful? Give feedback.