Skip to content

dreamRs/shinytreeview

Repository files navigation

shinytreeview

Hierarchical tree structures input for Shiny applications. Interface for bootstrap-treeview JS library.

Lifecycle: experimental

Installation

Install the development version from GitHub with:

remotes::install_github("dreamRs/shinytreeview")

Example

library(shiny)
library(shinytreeview)

data("cities")

ui <- fluidPage(
  tags$h3("treeviewInput cities example"),
  treeviewInput(
    inputId = "tree",
    label = "Choose a city:",
    choices = make_tree(cities, c("continent", "country", "city")),
    multiple = FALSE,
    prevent_unselect = TRUE
  ),
  verbatimTextOutput(outputId = "result")
)

server <- function(input, output, session) {
  output$result <- renderPrint({
    input$tree
  })
}

shinyApp(ui, server)