JohnCoene / cicerone

🏛️ Give tours of your Shiny apps
https://cicerone.john-coene.com
Other
186 stars 7 forks source link

Cicerone in Shiny Dashboard - Multitab Tour #21

Open optimaldecisiondynamics opened 3 years ago

optimaldecisiondynamics commented 3 years ago

Hi John,

I was excited to discover the cicerone package; it looks amazing!

I'm wondering if it's possible to use it in a shiny dashboard, with a multi-tab tour. Specifically, I converted the app in the Getting Started page (here) into a shiny dashboard of 2 tabs. I made no change to guide:

library(shiny)
library(shinydashboard)
library(cicerone)

guide <- Cicerone$
  new()$ 
  step(
    el = "text_inputId",
    title = "Text Input",
    description = "This is where you enter the text you want to print."
  )$
  step(
    "submit_inputId",
    "Send the Text",
    "Send the text to the server for printing"
  )

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Tab1", tabName = "tab1"),
      menuItem("Tab2", tabName = "tab2")
    )
  ),

  dashboardBody(
    use_cicerone(), # include dependencies
    tabItems(
      tabItem(
        tabName = "tab1",
        textInput("text_inputId", "Enter some text")
      ),

      tabItem(
        tabName = "tab2",
        actionButton("submit_inputId", "Submit text"),
        verbatimTextOutput("print")
      )
    )
  )
)

server <- function(input, output){

  # initialise then start the guide
  guide$init()$start()

  txt <- eventReactive(input$submit_inputId, {
    input$text_inputId
  })

  output$print <- renderPrint(txt())
}

shinyApp(ui, server)

The tour did not make it to the second step, contained on the second tab. It seems a tour must be self-contained on one tab.

Is it possible to create a tour that spans multiple tabs of a shiny dashboard?

Thank you for your time and consideration.

daattali commented 1 year ago

Any plans any plans on implementing this feature?

jzadra commented 2 months ago

This was implemented and never closed. It works in dev version 1.0.5.9000.