shiny.semantic icon indicating copy to clipboard operation
shiny.semantic copied to clipboard

Add custom svg icons collected in one sprite map

Open jchojna opened this issue 4 years ago • 3 comments

As an enhancement feature, we could make users able to add their own custom svg icons, collected in one sprite map svg file and having unique ids. Embedding svg icons using a sprite-map ( elements), instead of tags with src attribute pointing to specific svg file, gives the possibility to manipulate svg element's css properties, like fill, stroke etc. Thus it's possible to add some nice visual effects on events, like hover, click etc, which is not so simple or sometimes impossible, when using elements.

Some example function I created and used as a helper function, to return svg icon based on icons.svg sprite map:

svg_icon <- function(id, class, width, height) {
  return(
    HTML(
      glue::glue("
        <svg class = '{class}', viewBox = '0 0 {width} {height}'>
          <use href = 'icons/icons.svg#{id}'></use>
        </svg>"
      )
    )
  )
}

jchojna avatar Jul 17 '20 09:07 jchojna

How do we use the function, please? Are there any examples?

gesorabill avatar Jan 05 '21 20:01 gesorabill

Hi @Bill-Gesora,

This functionality is currently under development. https://github.com/Appsilon/shiny.semantic/pull/320 We will include an example shiny app using custom sprite map. At this development stage I cannot advice you about the code above for using custom sprite maps. It has not been fully yet tested and the function code probably will change before it is released.

osenan avatar Jan 06 '21 04:01 osenan

@osenan Do you think there will be future development from your side on this issue? Currently, we are closing all the idle issues as a part of a general clean-up we started.

esraay avatar Jul 22 '22 08:07 esraay

Closing. Feel free to reopen it

esraay avatar Oct 21 '22 11:10 esraay