Re: [shinyapps-users] Creating Info Icon with rollover text

199 views
Skip to first unread message

Tareef Kawaf

unread,
Nov 11, 2015, 7:29:45 AM11/11/15
to Abigail-Joy Low, shiny-...@googlegroups.com
This sounds like more of a general shiny question than something related to shinyapps.io.  Moving to the shiny-discuss list.

On Wed, Nov 11, 2015 at 5:10 AM, Abigail-Joy Low <abigai...@gmail.com> wrote:
Hi,

I have some numericInputs and would like to put an information icon next to it, so that when users roll over the information icon, there are instructions on how to fill the numeric input.
How do I go about this?

numericInput("standardincome", label = h4("What is your monthly household income?"), value = "0", min=0, icon="fa-info-circle")

renders an error, while

numericInput("standardincome", label = h4("What is your monthly household income?", icon="fa-info-circle"), value = "0", min=0),  

does not show the icon.

I have two main questions:

1. How do I make the icon show up
2. How do I attached text to the icon when the user rolls over the icon?

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/9322ea77-9961-4633-bb00-d7962b884fbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robin Cura

unread,
Nov 11, 2015, 8:11:44 AM11/11/15
to Tareef Kawaf, Abigail-Joy Low, shiny-...@googlegroups.com
Hi,

The icon should display, but you're not using a correct name/syntax ;)
You can display this icon this way :
      numericInput("standardincome",
                   label = h4("What is your monthly household income?", icon("info-circle")),

                   value = "0", min=0),

To add a tooltip, the easier is to use the shinyBS package :
library(shinyBS)
and then, you can display it this way :

      numericInput("standardincome2",
                   label = h4("What is your monthly household income?", tipify(icon("info-circle"), title = "my tooltip content")),
                   value = 0, min=0),

Or, you could also add the tooltip on the numeric input itself, this way :

      numericInput("standardincome3", label = h4("What is your monthly household income?"), value = 0, min=0),
      bsTooltip(id = "standardincome3", title = "tooltip content", placement = "right")

You can find those in this gist : https://gist.github.com/RCura/2e4e2fe6b02a0c80adad / and run it with : runGist("2e4e2fe6b02a0c80adad")

HTH,

Robin


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/CAMYk84ygfrqJQ%2BZ1zuWcJJ5M5J%2Bh-tG9VheMcg23jrmbytRf8Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages