Skip to content

Add custom svg icons collected in one sprite map #226

@jchojna

Description

@jchojna

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>"
      )
    )
  )
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions