Closed Rogerjwhill closed 3 years ago
Here's an example of how you can use icon_set()
in a shiny app. Note that you should use relative paths, as if you later choose to run your app on a server, it won't know how to find "T:/4_Software_and_Training/..."
# Obtain icon for demo (only needed to run once)
xfun::dir_create("hex")
download.file("https://raw.githubusercontent.com/mitchelloharawild/icons/master/hex/icons.svg", "hex/icons.svg")
library(shiny)
library(icons)
# Load your custom icon library and give it a name
hex_stickers <- icon_set("hex/")
# Define UI for application that draws a histogram
ui <- fluidPage(
# Add SVG icon as an image
actionButton("shiny", "icons!", icon=NULL,width=NULL, img(hex_stickers$icons))
)
# Define server logic required to draw a histogram
server <- function(input, output) {
}
# Run the application
shinyApp(ui = ui, server = server)
Brilliant thank you.
I have a folder of svg that I need to be able to use as icons in an R shiny app. It is unclear how the functions work to load these as icons and then use them.
Would you be able to provide a working example of how to do this if it is possible. I have tired:
but it is not clear if this works or how to then use these icons in the kind of way discussed in this thread https://community.rstudio.com/t/use-of-open-source-icons-in-shiny/110056/3:
Any help or advice would be appreciated. Thank you