introjs: Initiate intro.js

View source: R/introjs.R

introjsR Documentation

Initiate intro.js

Description

Initiates an introduction via the intro.js library

Usage

introjs(session, options = list(), events = list())

hintjs(session, options = list(), events = list())

Arguments

session

the Shiny session object (from the server function of the Shiny app)

options

List of options to be passed to intro.js

events

List of text that are the body of a Javascript function. Must wrap in I()

Note

For documentation on intro.js options and events, see https://introjs.com/docs/.

See Also

introjsUI() introBox()

Examples

## Not run: 
library(rintrojs)
library(shiny)
ui <- shinyUI(fluidPage(
  introjsUI(), # must include in UI
  mainPanel(
    introBox(
      tableOutput("mtcars"),
      data.step = 1,
      data.intro = "This is the table"
    ),
    introBox(
      actionButton("btn","Intro"),
      data.step = 2,
      data.intro = "This is the button",
      data.hint = "Here is clue"
    )
  )))
server <- shinyServer(function(input, output, session) {

 hintjs(session, options = list("hintButtonLabel"="That was a hint"))

  output$mtcars <- renderTable({
    head(mtcars)
  })
  observeEvent(input$btn,
               introjs(session, options = list("nextLabel"="Onwards and Upwards"),
                                events = list("oncomplete"=I('alert("It is over")'))))
})
# Run the application
shinyApp(ui = ui, server = server)

## End(Not run)

carlganz/rintrojs documentation built on Feb. 2, 2024, 3:58 a.m.