I would like to know if there's a way to put the the sandwich icon on the left side of the title name.
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Title"),
dashboardSidebar(
),
dashboardBody()
)
server <- function(input, output, session) {
}
shinyApp(ui = ui, server = server)
Perhaps you can just use an image in your www folder. Try this
ui <- dashboardPage(
dashboardHeader(
title = div(img(src = 'hotdog.png', title = "A Test Application", height = "30px"),
"My Title", style = "position: relative; margin:-3px 0px 0px 5px; display:right-align;"
)
),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output, session) {}
shinyApp(ui = ui, server = server)
Related
Does anyone know how to make the title of a tabBox go above the tabs in a shinydashboard app? For example, in the figure below, the title is on the right, but I would like it to go on top of the box.
Code for this tabBox:
library(shiny)
library(shinydashboard)
ui = dashboardPage(dashboardHeader(title = "tabBoxes"), dashboardSidebar(),
dashboardBody(
fluidRow(
tabBox(title = HTML("Hello friend<br>"),
tabPanel("merp", "hi there"),
tabPanel("derp", "hello"),
tabPanel("herp", "howdy")
))
)
)
server = function(input, output) {
# The currently selected tab from the first box
output$tabset1Selected <- renderText({
input$tabset1
})
}
shinyApp(ui = ui, server = server
)
For those who might look for the solution here, a pretty simple fix was to put the tabBox (with no title) inside of a box with a title:
library(shiny)
library(shinydashboard)
ui = dashboardPage(dashboardHeader(title = "tabBoxes"), dashboardSidebar(),
dashboardBody(
fluidRow(box(title = HTML("Hello friend<br>"),
tabBox(
tabPanel("merp", "hi there"),
tabPanel("derp", "hello"),
tabPanel("herp", "howdy"))
))
)
)
server = function(input, output) {
# The currently selected tab from the first box
output$tabset1Selected <- renderText({
input$tabset1
})
}
shinyApp(ui = ui, server = server)
There is the side argument e.g
library(shiny)
library(shinydashboard)
body <- dashboardBody(
fluidRow(
tabBox(
title = "First tabBox",
# The id lets us use input$tabset1 on the server to find the current tab
id = "tabset1", height = "250px",side = 'right',
tabPanel("Tab1", "First tab content"),
tabPanel("Tab2", "Tab content 2")
)
))
shinyApp(
ui = dashboardPage(dashboardHeader(title = "tabBoxes"), dashboardSidebar(), body),
server = function(input, output) {
# The currently selected tab from the first box
output$tabset1Selected <- renderText({
input$tabset1
})
}
)
Hi I feel like this should be simple but I can't find a solution anywhere.
In the code below I have made the navbarpage collapsible but can't find a way to achieve the same thing for a tabsetpanel so the app ends up looking messy on e.g. a mobile device.
library(shiny)
# Define UI
ui <- fluidPage(
navbarPage("Hello",
collapsible=T,
tabPanel("a",
tabsetPanel(type = "tabs",
tabPanel("1"),
tabPanel("2"),
tabPanel("3"),
tabPanel("4"),
tabPanel("5"))),
tabPanel("b"),
tabPanel("c"),
tabPanel("d"),
tabPanel("e")
)
)
server <- function(session,input, output) {
}
shinyApp(ui = ui, server = server)
Thanks for your help!
You can use the bootstrap-tabcollapse library. Download the js file and put it in the www subfolder.
library(shiny)
js <- "$(document).ready(function(){$('#tabset').tabCollapse();});"
ui <- fluidPage(
tags$head(
tags$style(
HTML(
"a.js-tabcollapse-panel-heading {
display: block;
text-align: center;
}"
)
),
tags$script(src = "bootstrap-tabcollapse.js"),
tags$script(HTML(js))
),
navbarPage("Hello",
collapsible=T,
tabPanel("a",
tabsetPanel(type = "tabs",
tabPanel("1", tags$p("hello")),
tabPanel("2", tags$p("hi")),
tabPanel("3"),
tabPanel("4"),
tabPanel("5"),
id = "tabset")),
tabPanel("b"),
tabPanel("c"),
tabPanel("d"),
tabPanel("e")
)
)
server <- function(session,input, output) {
}
shinyApp(ui = ui, server = server)
How can you place text exactly in the middle between left and right end of shiny dashboard body at this height?
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(disable = T),
dashboardBody(
fluidRow(
column(5,),
column(4,
span(h2(strong("Covid-19 Situation Dashboard"), style = 'font-size:30px;color:#6cbabf;')))
)
)
)
server <- function(input, output) { }
shinyApp(ui, server)
Use align = "center", as shown below.
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(disable = T),
dashboardBody(
fluidRow(
#column(5,),
column(12,
span(h2(strong("Covid-19 Situation Dashboard"), align = "center", style = 'font-size:30px;color:#6cbabf;')))
)
)
)
server <- function(input, output) { }
shinyApp(ui, server)
How can I change the font size and color of title in shinydashboard box()?
library(shiny)
library(plotly)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width=12)),
fluidRow(
box(title="Title")
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
r
You can use a header tag and style option within it.
library(shiny)
library(plotly)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width=12)),
fluidRow(
box(title=h3("Title", style = 'font-size:42px;color:blue;'))
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
I am trying to put an image inside the infoBox of a shinyApp.
I am getting this error:
Error in shinyUI(dashboardPage, dashboardHeader("ABC"),
dashboardBody(fluidPage(h1("type"), : unused arguments
(dashboardHeader("ABC"), dashboardBody(fluidPage(h1("type"),
mainPanel(tabsetPanel(tabPanel(h1("summary"), infoBox("BCD", a,
div(img(src = "ribbon.PNG", width = 100), style = "text-align:
center;"))))))))
Code:
library(shiny)
library(shinydashboard)
a = 45
ui < - shinyUI(dashboardPage,
dashboardHeader("ABC"),
dashboardBody(fluidPage(h1("type"),
mainPanel(
tabsetPanel(
tabPanel(h1("summary"),
infoBox("BCD", a, div(img(src = "ribbon.PNG",
width = 100), style = "text-align: center;"))))))))
server <- shinyServer({})
shinyApp(ui, server)
Can anyone help me on this?
Set an image img.png in the www folder and then the code below works :
library(shiny)
library(shinydashboard)
a <- 45
ui <- shinyUI(
dashboardPage(
dashboardHeader(title = "ABC"),
dashboardSidebar(),
dashboardBody(
fluidPage(
infoBox("BCD", a, div(img(src = "img.png", width = 100), style = "text-align: center;"))
)
)
)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)