BlazorStyled icon indicating copy to clipboard operation
BlazorStyled copied to clipboard

Dynamic Id or Class names?

Open VR-Architect opened this issue 5 years ago • 2 comments

Here is another feature request :)

It would be great if we could dynamically set the id or the class name? In my scenario I am dynamically setting an Id for a component and storing the CSS values into a database. The page that presents the component could present multiple instances of the component. Each component has a different Id with different CSS values but the same CSS structure.

Example:

#@MyComponent.Id{ ... my CSS here ... }

VR-Architect avatar Apr 11 '20 15:04 VR-Architect

That should work. But I will check to make sure later today

Another option though would be:

<Styled Classname=“@myvar”>
Css goes here without {}
</Styled>

I think should do what you want

chanan avatar Apr 11 '20 17:04 chanan

@VR-Architect Did my suggestion of using Classname in the styled tag work for you? If not, if the issue is a compiler error like in #87 then will adding <text></text> work? If the answer to both of those are "no", then I need a code example of what you want to do.

chanan avatar Apr 11 '20 22:04 chanan