actionLink

Published by onesixx on

Show/More UI

ui = fluidPage(
  useShinyjs(),
  actionLink(inputId="link_showMore", "More", icon=icon("caret-down"), style="color:red; text-decoration:none;"),
  div(id="div_showMore", 
    hr(style="margin:6px;"),
    verbatimTextOutput(outputId="txt_contents")
  ) %>% hidden()
)

server = function(input, output, session){
  observeEvent(input$link_showMore, {
    toggle('div_showMore')
    updateActionButton(session, "link_showMore", 
    \t               label=ifelse(input$link_showMore%%2==1, "Hide", "More"),
    \t               icon=icon(ifelse(input$link_showMore%%2==1, "caret-up", "caret-down")) )
    output$txt_contents <- renderText({
      "blah blah ..."
    })
  })
}
  
shinyApp(ui,server)
Categories: R-Shiny

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x