Reputation: 585
I am creating a basic shiny app to compile some R markdown and HTML files.
Everything works fine but I'm not really sure why the title doesn't sit on the same line as the "Introduction" and "My Notes" tabs at the top of the page.
Here is the basic code from app.R
library(tidyverse)
library(shiny)
# Define UI for application
ui <- fluidPage(
navbarPage(titlePanel("My Jupyter Notes"),
tabPanel(title = "Introduction"),
tabPanel(title = "My Notes",
mainPanel(
tabsetPanel(
type = "tabs",
tabPanel("Week 1"),
tabPanel("Week 2"),
tabPanel("Week 3")
)
)
)
)
)
# Define server logic
server <- function(input, output) {
}
# Run the application
shinyApp(ui = ui, server = server)
Note: I edited out the includeMarkdown(FILE PATH)
which would have been in the "Introduction" tab and includeHTML(FILE PATH)
which would have been in the "Week 1/2/3" tabs under "My Notes".
Does anyone know why this is happening and how to fix it?
Upvotes: 0
Views: 389
Reputation: 10375
I think that titlePanel
is not thought to work together with navbarPage
. In the navbarPage
, you can use the native title
argument:
library(shiny)
# Define UI for application
ui <- fluidPage(
navbarPage(title = "My Jupyter Notes",
tabPanel(title = "Introduction"),
tabPanel(title = "My Notes",
mainPanel(
tabsetPanel(
type = "tabs",
tabPanel("Week 1"),
tabPanel("Week 2"),
tabPanel("Week 3")
)
)
)
)
)
# Define server logic
server <- function(input, output) {
}
# Run the application
shinyApp(ui = ui, server = server)
Upvotes: 1