Skip to content

Instantly share code, notes, and snippets.

@dataprofessor
Last active November 10, 2020 14:55
Show Gist options
  • Save dataprofessor/f9dc9d878e97e907aae807b6345433e4 to your computer and use it in GitHub Desktop.
Save dataprofessor/f9dc9d878e97e907aae807b6345433e4 to your computer and use it in GitHub Desktop.
# Load R packages
library(shiny)
library(shinythemes)
# Define UI
ui <- fluidPage(theme = shinytheme("cerulean"),
navbarPage(
"My first app",
tabPanel("Navbar 1",
sidebarPanel(
tags$h3("Input:"),
textInput("txt1", "Given Name:", ""),
textInput("txt2", "Surname:", "")
), # sidebarPanel
mainPanel(
h1("Header 1"),
h4("Output 1"),
verbatimTextOutput("txtout")
) # mainPanel
), # Navbar 1, tabPanel
tabPanel("Navbar 2", "This panel is intentionally left blank"),
tabPanel("Navbar 3", "This panel is intentionally left blank")
) # navbarPage
) # fluidPage
# Define server function
server <- function(input, output) {
output$txtout <- renderText({
paste( input$txt1, input$txt2, sep = " " )
})
}
# Create Shiny object
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment