Repository navigation
SVG icons #113
Unanswered
janilcgarcia
asked this question in
Q&A
SVG icons
#113
Replies: 2 comments 4 replies
|
@janilcgarcia Hi! I'm doing something like this normally for svg: And using this to get the scala code out of svg(html): (just noticed that Laminar is now explicitly supported :); before that, scalatags option worked fine as well, except some minor issues with more complicated cases) |
1 reply
|
People have been asking for this a few times already, I think I'll implement some kind of helper to do this in one step. If you don't want to use html-to-scala-converter, the process is two steps:
Or val mySvgElement = new ChildNode[HTMLElement] {
val ref: dom.svg.Element = yourJsSvgElement
}
div(..., mySvgElement) |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Has anyone tried using pre-made SVG icons directly in laminar? Like bootstrap icons or font-awesome? What are you doing?
I ended up doing something like this first:
But now moving back to using CSS classes + icon font, because transforming SVG code into Scala DOM Types code for every icon I want to use is particularly not intuitive.
Quite honestly I would love to have something like this:
https://fontawesome.com/v5.15/how-to-use/on-the-web/using-with/react#using
But I don't know how that works in React and I have no idea how to implement that in Laminar. Honestly, It would be enough to have a way I could just paste the SVG string in my code and transform it an icon, so I could just store the icons in an object like this:
How could I implement
stringToReactiveElementup there? It doesn't even need to be a ReactiveElement, it'd be happy with anything I could just pass as modifier to other elements.All reactions