Giter Site home page Giter Site logo

michaelchirico / bslib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rstudio/bslib

1.0 2.0 0.0 30.71 MB

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.

Home Page: https://rstudio.github.io/bslib/

License: Other

JavaScript 7.11% R 15.01% TypeScript 0.58% CSS 0.46% Less 0.12% SCSS 76.73%

bslib's Introduction

CRAN status Lifecycle: experimental R build status

bslib

The bslib R package provides tools for customizing Bootstrap themes directly from R, making it much easier to customize the appearance of Shiny apps & R Markdown documents. bslib’s primary goals are:

Installation

Install the stable release of bslib on CRAN:

install.packages("bslib")

Usage with Shiny requires version 1.6 or higher:

install.packages("shiny")

Usage with R Markdown requires version 2.7 or higher:

install.packages("rmarkdown")

Basic usage

bslib is designed for use with any Shiny or R Markdown project that uses Bootstrap. In most cases, you can identify a project that uses Bootstrap when the relevant page constructor has a theme parameter. For example, most Shiny page layout functions (e.g., shiny::navbarPage()) and some popular R Markdown formats (e.g., rmarkdown::html_document) all have a theme parameter.

To use bslib in Shiny, provide a bs_theme() object to the theme parameter; and in R Markdown, provide bs_theme() parameters to theme. For example, here’s a way to upgrade Shiny (left) and R Markdown (right) from Bootstrap 3 to 5:

library(shiny)
ui <- navbarPage(
  theme = bs_theme(version = 5),
  ...
)
shinyApp(ui, function(...) {})
---
output:
  html_document:
    theme:
      version: 5
---

See the Get Started article to learn more about Bootstrap versions, pre-packaged Bootswatch themes, (real-time) custom theming, and more.

To get started more quickly, choose a relevant R Markdown template from inside RStudio by going to File -> New File -> R Markdown -> From Template:

Getting help

There are two main places to get help with bslib:

  • The RStudio community is a friendly place to ask any questions (be sure to add a bslib tag when creating a topic).

  • Stack Overflow is a great source of answers to common bslib questions. It is also a great place to get help, once you have created a reproducible example that illustrates your problem. Use the tags [r][bslib] if you ask a question. Add the tag [bslib] if you are using a Shiny runtime.

Code of Conduct

Please note that the bslib project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

bslib's People

Contributors

apreshill avatar cpsievert avatar indrajeetpatil avatar jcheng5 avatar lionel- avatar maelle avatar polkas avatar schloerke avatar wch avatar

Stargazers

 avatar

Watchers

 avatar  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.