Description Usage Arguments Details Value Examples
Add popover to any Shiny element you want. You can also customize color, font size, background color, and more for each individual popover.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | bsPopover(
tag,
title = "",
content = "",
placement = "top",
bgcolor = "#ebebeb",
titlecolor = "black",
contentcolor = "black",
titlesize = "14px",
contentsize = "12px",
titleweight = "600",
contentweight = "400",
opacity = 1,
html = FALSE,
trigger = "hover focus"
)
bsHoverPopover(
tag,
title = "",
content = "",
placement = "top",
bgcolor = "#ebebeb",
titlecolor = "black",
contentcolor = "black",
titlesize = "14px",
contentsize = "12px",
titleweight = "600",
contentweight = "400",
opacity = 1,
html = FALSE,
trigger = "hover focus"
)
bsPop(
tag,
title = "",
content = "",
placement = "top",
status = "primary",
titlesize = "14px",
contentsize = "12px",
titleweight = "600",
contentweight = "400",
opacity = 1,
html = TRUE,
trigger = "hover focus"
)
|
tag |
a shiny tag as input |
title |
string, popover title |
content |
string, popover cotent |
placement |
string, one of "top", "bottom", "left", "right", where to put the tooltip |
bgcolor |
string, background color, valid value of CSS color name or hex value or rgb value |
titlecolor |
string, title text color, valid value of CSS color name or hex value or rgb value |
contentcolor |
string, content text color, valid value of CSS color name or hex value or rgb value |
titlesize |
string, title text font size, valid value of CSS font size, like "10px", "1rem". |
contentsize |
string, content text font size, valid value of CSS font size, like "10px", "1rem". |
titleweight |
string, CSS valid title font weight unit |
contentweight |
string, CSS valid content font weight unit |
opacity |
numeric, between 0 and 1 |
html |
bool, allow title contain HTML code? like |
trigger |
string, how to trigger the tooltip, one or combination of click | hover | focus | manual. |
status |
string, used only for wrapper bsPop, see details |
For trigger methods read: https://getbootstrap.com/docs/3.3/javascript/#tooltips-options.
For font weight, see: https://www.w3schools.com/cssref/pr_font_weight.asp
bsHoverPopover is the old name but we still keep it for backward compatibility.
bsPop is the convenient function for bsPopover, which has the background
and content color set to 5 different bootstrap colors, you can use status
to set, one of "primary", "info", "success", "warning", "danger"
shiny tag
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | if(interactive()){
library(shiny)
library(magrittr)
ui <- fluidPage(
br(), br(), br(), br(), br(), br(), column(2),
actionButton("", "Popover on the left") %>%
bsPopover("Popover on the left", "content", "left"),
actionButton("", "Popover on the top") %>%
bsPopover("Popover on the top", "content", "top"),
actionButton("", "Popover on the right") %>%
bsPopover("Popover on the right", "content", "right"),
actionButton("", "Popover on the bottom") %>%
bsPopover("Popover on the bottom", "content", "bottom"),
br(), br(), column(2),
actionButton("", "primary color") %>%
bsPopover(
"primary color", "content", bgcolor = "#0275d8",
titlecolor = "white", contentcolor = "#0275d8"),
actionButton("", "danger color") %>%
bsPopover(
"danger color", "content", bgcolor = "#d9534f",
titlecolor = "white", contentcolor = "#d9534f"),
actionButton("", "warning color") %>%
bsPopover(
"warning color", "content", bgcolor = "#f0ad4e",
titlecolor = "white", contentcolor = "#f0ad4e"),
br(), br(), column(2),
actionButton("", "9px & 14px") %>%
bsPopover("9px", "14", titlesize = "9px", contentsize = ),
actionButton("", "14px & 12px") %>%
bsPopover("14px", "12", titlesize = "14px"),
actionButton("", "20px & 9px") %>%
bsPopover("20px", "9", titlesize = "20px"),
br(), br(), column(2),
actionButton("", "weight 100 & 800") %>%
bsPopover("weight 100", "800", titleweight = "100", contentweight = "800"),
actionButton("", "weight 400 & 600") %>%
bsPopover("weight 400", "600", titleweight = "400", contentweight = "600"),
actionButton("", "weight 600 & 400") %>%
bsPopover("weight 600", "400", titleweight = "600", contentweight = "400"),
actionButton("", "weight 900 & 200") %>%
bsPopover("weight 900", "200", titleweight = "900", contentweight = "200"),
br(), br(), column(2),
actionButton("", "opacity 0.2") %>%
bsPopover("opacity 0.2", opacity = 0.2),
actionButton("", "opacity 0.5") %>%
bsPopover("opacity 0.5", opacity = 0.5),
actionButton("", "opacity 0.8") %>%
bsPopover("opacity 0.8", opacity = 0.8),
actionButton("", "opacity 1") %>%
bsPopover("opacity 1", opacity = 1),
br(), br(), column(2),
actionButton("f1", "allow html: 'abc<span class='text-danger'>danger</span>'") %>%
bsPopover(HTML("abc<span class='text-danger'>danger</span>"),
html = TRUE, bgcolor = "#0275d8"),
actionButton("f2", "allow html: '<s>del content</s>'") %>%
bsPopover(HTML("<s>del content</s>"), html = TRUE, bgcolor = "#d9534f")
)
server <- function(input, output, session) {}
shinyApp(ui, server)
}
if(interactive()){
library(shiny)
library(magrittr)
ui <- fluidPage(
br(), br(), br(), br(), br(), br(), column(2),
actionButton("", "primary") %>%
bsPop("primary", "primary", status = "primary"),
actionButton("", "info") %>%
bsPop("info", "info", status = "info"),
actionButton("", "success") %>%
bsPop("success", "success", status = "success"),
actionButton("", "warning") %>%
bsPop("warning", "warning", status = "warning"),
actionButton("", "danger") %>%
bsPop("danger", "danger", status = "danger")
)
server <- function(input, output, session) {}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.