I have a tabBox
in a shiny
dashboard and would like to add a download button on the right of the tabs where the title of the tabBox
would usually appear:
Any suggestions on how to do this?
Here is some minimal code to work with (without the required download box):
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "tabBoxes"),
dashboardSidebar(disable=TRUE),
dashboardBody(
fluidRow(
tabBox(
title = 'Download Button',
width = 12,
tabPanel("Tab1", "Some text for tab 1"),
tabPanel("Tab2", "Some text for tab 2")
)
))
)
server <- function(input, output) { }
shinyApp(ui, server)
CodePudding user response:
Turns out its as simple as setting the tabBox
title equal to a downloadButton
!
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "tabBoxes"),
dashboardSidebar(disable=TRUE),
dashboardBody(
fluidRow(
tabBox(
title = downloadButton(outputId = 'downloadData', label='Download'),
width = 12,
tabPanel("Tab1", "Some text for tab 1"),
tabPanel("Tab2", "Some text for tab 2")
)
))
)
server <- function(input, output) { }
shinyApp(ui, server)