GithubHelp home page GithubHelp logo

isabella232 / shinythemes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rstudio/shinythemes

0.0 0.0 0.0 3.29 MB

Themes for Shiny

Home Page: http://rstudio.github.io/shinythemes/

License: Other

R 100.00%

shinythemes's Introduction

shinythemes

NOTE: This package has been superseded by the {bslib} package, which provides Bootswatch (and as well as custom) themes for both Bootstrap 3 and 4.

See the documentation at https://rstudio.github.io/shinythemes/.

The shinythemes package provides some Bootstrap themes for use with Shiny. The themes are from from https://bootswatch.com/:

Using themes

Using the themes is simple. Use the theme argument to bootstrapPage, fluidPage, navbarPage, or fixedPage. The value should be shinytheme("<theme>"); for example, shinytheme("cerulean").

For example, a single-file app might look like this:

shinyApp(
  ui = navbarPage("United",
    theme = shinythemes::shinytheme("united"),  # <--- Specify theme here
    tabPanel("Plot", "Plot tab contents..."),
    navbarMenu("More",
      tabPanel("Summary", "Summary tab contents..."),
      tabPanel("Table", "Table tab contents...")
    )
  ),
  server = function(input, output) { }
)

Live theme selector

If you want to quickly test out different themes with an application, you can simply add themeSelector() somewhere to the UI. This will add a select box which lets you choose the theme. It will change the theme without having to reload or restart your app. You can see the theme selector in action here.

The theme selector is only meant to be used while developing an application. Once you've decided on which theme to use, pass it to the theme argument as described earlier.

Here's an example app with the theme selector:

shinyApp(
  ui = fluidPage(
    shinythemes::themeSelector(),  # <--- Add this somewhere in the UI
    sidebarPanel(
      textInput("txt", "Text input:", "text here"),
      sliderInput("slider", "Slider input:", 1, 100, 30),
      actionButton("action", "Button"),
      actionButton("action2", "Button2", class = "btn-primary")
    ),
    mainPanel(
      tabsetPanel(
        tabPanel("Tab 1"),
        tabPanel("Tab 2")
      )
    )
  ),
  server = function(input, output) {}
)

Once you've found a theme that you like, use it in the page as shown above, with theme = shinythemes::shinytheme(<theme here>).

shinythemes's People

Contributors

calpan avatar cpsievert avatar jennybc avatar wch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.