I am currently working on a dashboard project and I am looking to implement a dynamic popup feature that can be moved around. I have been able to create a pop-up, but it remains static. I would like the flexibility for users to drag and position the popup wherever they prefer.
Here is an example of my current implementation:
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
sidebarLayout(
box(actionButton("tabBut", "View Table")),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
dataTableOutput("distTable"))))),
server =
function(input, output, session) {
output$distTable <- renderDataTable({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = 30 + 1)
tab <- hist(x, breaks = bins, plot = FALSE)
tab$breaks <- sapply(seq(length(tab$breaks) - 1), function(i) {
paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3))})
tab <- as.data.frame(do.call(cbind, tab))
colnames(tab) <- c("Bins", "Counts", "Density")
return(tab[, 1:3])},
options = list(pageLength=10))}
)
I am looking for ways to enable users to move this popup window. If you have suggestions for different options or if you know of alternative methods besides using Shiny BS to create movable windows, please let me know!
Thank you in advance and apologies for any language barriers!