Create a gist now

Instantly share code, notes, and snippets.

Shiny Framework Function Reference Sheet

Shiny Reference Sheet

A web application framework for R quick function reference sheet.


Function Creates
actionButton() Action button element
submitButton() Submit button element
checkboxInput() Checkbox input element
checkboxGroupInput() Checkbox group input element
dateInput() Date input element
dateRangeInput() Date range input element
fileInput() File input element
numericInput() Numeric input element
passwordInput() Password input element
radioButtons() Radio button element
selectInput() Select input element
sliderInput() Slider input element
textInput() Text input element

Display Output

Function Creates
renderDataTable() An interactive table A plot (from a data frame, matrix, or other table-like structure)
renderImage() An image (saved as a link to a source file)
renderPlot() A Plot
renderPrint() A code block of printed output
renderTable() A table (from a data frame, matrix, or other table-like structure)
renderText() A character string
renderUI() A Shiny UI element


Function Inserts
dataTableOutput() An interactive table image
htmlOutput() Raw HTML
imageOutput() Image
plotOutput() Plot
tableOutput() Table
textOutput() Text
uiOutput() A Shiny UI element
verbatimTextOutput() Text


  1. Code chunk build/rebuild object
  2. Object responds to changes in set of reactive values
Function Description
reactive() Reactive object
isolate() Non-reactive object
observeEvent() Trigger code to run on server, specify reactive value precisely
observe() Trigger code to run on server, more general


Function Description
eventReactive() Reactive expression only responds to specific values

Managing State

Function Description
reactiveValues() List of reactive values to manipulate programmatically ( usually with observeEvent() )


Type names(tags) to get all available HTML tags.

Some tags functions come with a wrapper function, so you do not need to call tags$.

Function Creates
a() A Hyperlink
br() A line break
code() Text formatted like computer code
em() Italicized (emphasized) text
h1(), h2(), h3(), h4(), h5(), h6() Headers (First level to sixth)
hr() A horizontal rule (line)
img() An image
p() A new paragraph
strong() Bold (strong) text


Function Creates
fluidRow() Adds rows to the grid
column() Adds columns within a row
sidebarLayout() Use with sidebarPanel() and mainPanel() to divide app into 2 sections
fixedPage() Creates page with default width of browser window
fixedRow() Adds row to grid using fixedPage()
navbarPage() Replaces fluidPage(). Combines tabs into single page



A dashboard like layout package of functions for building dashboards with Shiny.


Group elements into single unit for aesthetics or functionality.

Function Creates
absolutePanel() Panel position set rigidly (absolutely), not fluidly
conditionalPanel() A JavaScript expression determines whether panel is visible or not
fixedPanel() Panel is fixed to browser window and does not scroll with the page
headerPanel() Panel for displaying a sidebar of inputs, used with pageWithSidebar()
inputPanel() Panel with grey background, suitable for grouping inputs
mainPanel() Panel for displaying output, used with pageWithSidebar()
navlistPanel() Panel for displaying multiple stacked tabPanels(). Uses sidebar navigation
sidebarPanel() Panel for displaying a sidebar of inputs, used with pageWithSidebar()
tabPanel() Stackable panel. Used with navlistPanel() and tabsetPanel()
tabsetPanel() Panel for displaying multiple stacked tabPanels(). Uses tab navigation
titlePanel() Panel for the app’s title, used with pageWithSidebar()
wellPanel() Group elements into a grey background ("well")


Function Inserts

Adding Images

To add an image from a file, save the file in a subdirectory named www in app directory.


  1. Link to external CSS file
    • Place .css files in www app directory.

      • theme argument inside fluidPage() set to .css file for whole app to use
      ui <- fluidPage(
          theme = "bootswatch-cerulean.css",
    • Place link in the app's header with tags$head() and tags$link() to file.

      • Creates header section in app with rel, type, and href arguments.
      ui <- fluidPage(
                  rel = "stylesheet",
                  type = "text/css",
                  href = "file.css"
2. Write global CSS in header
    - Use `tags$head()` and `tags$style` and `HTML()`
    ui <- fluidPage(
            tags$style( HTML(" 
    - Use `includeCSS()` with file in app directory (not necessary in www) by copying all contents to webpage.
    ui <- fluidPage(

3. Write individual CSS in tag's style attribute
    ui <- fluidPage(
            tags$h1("Title", style = "color:red;")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment