简体   繁体   中英

change CSS of single element from shinyWidgets in flexdashboard

Related to questions here and here , I would like to change the CSS of a pickerInput menu from ShinyWidgets. I am using flexdashboard and I would like the styling to match exactly that from the selectInput menu. I realize I can do this by setting the overall theme in the YAML to bootstrap, but I'd prefer not to use a global solution.

---
title: "Testing picker styles"
output: 
  flexdashboard::flex_dashboard
runtime: shiny
---
  
```{r setup, include=F}
library(shiny)
library(flexdashboard)
library(shinyWidgets)
```

Column 
-----------------------------------------------------------------------
  
```{r}
selectInput(inputId = "id1", label = "Select input", choices = attr(UScitiesD, "Labels"))
pickerInput(inputId = "id2", label = "Picker input", choices = attr(UScitiesD, "Labels"))
```

在此处输入图像描述

pickerInput is styled like a Bootstrap button, and {flexdashboard} use Bootswatch's Cosmo theme ( https://bootswatch.com/3/cosmo/ ) that's why it appears black.

You can change the class of the button with:

options = pickerOptions(style = "btn-link")

(in pickerInput arguments)

在此处输入图像描述

Or you can overwrite the base style like this:

options = list("style-base" = "form-control", style = "")

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM