Any suggestions for how to neatly indent bulleted text rendered in a R Shiny hover-over tooltip, as illustrated in the below images? I post the code at the bottom.
Here is how the tooltip currently renders, without indentation:
Here I illustrate the cleaner indentation that I am trying to achieve of the text that follows the bullets:
Code:
library(shiny)
ui <- fluidPage(
tags$head(
tags$style(HTML("
.tooltip-inner {
text-align: left !important;
}
"))
),
div(
style = "text-align: center; margin-bottom: 10px;",
h3("Dynamic Curve Generator"),
div(
style = "text-align: center; margin-bottom: 10px;",
span(
"Instructions",
id = "instruction_label"
),
tags$script(HTML("
$(document).ready(function() {
$('#instruction_label').attr('title',
`• <b>Drag</b> blue control point bubbles to shape a curve<br>
• <b>Right-click</b> the curve to add more points for finer shaping<br>`
).tooltip({
html: true,
placement: 'bottom'
});
});
"))
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
Below is a solution that takes into account Tim G's comment, and also reduces the internal left margin of the tooltip which makes for a very clean presentation:
library(shiny)
ui <- fluidPage(
tags$head(
tags$style(HTML("
.tooltip-inner {
text-align: left !important;
}
.tooltip-inner ul {
padding-left: 18px; /* smaller left margin in tooltip */
margin-bottom: 0;
}
"))
),
div(
style = "text-align: center; margin-bottom: 10px;",
h3("Dynamic Curve Generator"),
div(
style = "text-align: center; margin-bottom: 10px;",
span(
"Instructions",
id = "instruction_label"
),
tags$script(HTML("
$(document).ready(function() {
$('#instruction_label').attr('title',
`<ul>
<li><b>Drag</b> blue control point bubbles to shape a curve</li>
<li><b>Right-click</b> the curve to add more points for finer shaping</li>
</ul>`
).tooltip({
html: true,
placement: 'bottom'
});
});
"))
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)