Skip to content
Discussion options

You must be logged in to vote

Hi @BorisDelange! Thanks for your question and praise 🙂

You can get the clicked tab using onLinkClick prop the following way:

library(shiny)
library(shiny.fluent)
library(glue)

setClickedId <- function(inputId) {
  JS(glue("item => Shiny.setInputValue('{inputId}', item.props.id)"))
}

shinyApp(
  ui = tagList(
    textOutput("text"),
    Pivot(
      onLinkClick = setClickedId("currentTab"),
      PivotItem(id = "tab1", headerText = "Apples"),
      PivotItem(id = "tab2", headerText = "Bananas")
    )
  ),
  server = function(input, output) {
    output$text <- renderText(input$currentTab)
  }
)

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
9 replies
@jakubsob
Comment options

@BorisDelange
Comment options

@ugurdar
Comment options

@ugurdar
Comment options

@ugurdar
Comment options

Answer selected by BorisDelange
Comment options

You must be logged in to vote
1 reply
@justacec
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants