Ability to inject and retrieve class name
See original GitHub issueSome 3rd party react components allow user to customize their css via className property. I want to create the css class in kotlin-styled and then put the name of that class into custom component.
I’ve not found a good way to do this. At the moment I’m doing it like this:
object A : StyleSheet("A", isStatic = true) {
val B by css { ... }
}
I’m manuallying using A-B name and I also have to manually inoke this method to make sure it is added to css via A.B.invoke(CSSBuilder()).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How can I get the class name from a C++ object?
I get 1A , but the class name is one . The site cppreference.com says "There is no guarantee that the same std::type_info...
Read more >Using dependency injection in Java - Introduction - Tutorial
With this analysis it is able to create an instance of the class and inject the objects into the defined dependencies, via Java...
Read more >Assigning a class dynamically from a class name string
When I want to access the custom method move() in Tiger, I use the as operator to access animal as a Tiger class....
Read more >JavaScript adding a class name to the element - GeeksforGeeks
Using .className property: This property is used to add a class name to the selected element. Syntax: It is used to set the...
Read more >How to Dynamically Add a Class Name in Vue
Adding a dynamic class name is as simple as adding the prop :class="classname" to your component. Whatever classname evaluates to will be 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

Right, but I don’t want to use this in any kotlin css statement. I just want to use it in custom component that only accepts
classNameIt’s done like this:
Where
cssis an extension function ofStyledBuilder<*>,CustomStyledProps, or<P : CustomStyledProps> RElementBuilder<P>