knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(linne)
This vignette walks the user through some applications of linne.
Shiny developers often want to customise how shiny inputs look and feel, which can be a bother. Let's say we want to change the label color of the textInput
shiny input.
shiny::textInput(inputId = "text", "Label")
cat(as.character(shiny::textInput(inputId = "text", "Label")))
One might be tempted to only use sel_id('text')
, as demonstrated above, this would not work. We could instead use on of the infix operators select the child tag "label" of the input.
Linne$new()$ rule( sel_id("text") %child% sel_tag("label"), color = "#f4a717" )$show_css()
Now, just to demonstrate what is possible with CSS, say we want to change the font size of a specific option in a selectInput
.
shiny::selectInput("select", "Select one:", choices = letters[1:3])
cat(as.character(shiny::selectInput("select", "Select one:", choices = letters[1:3])))
We can again use a combination of selectors to select say, option "b", to a different size.
Linne$new()$ rule( sel_id("select") # inputId = "select" %child% sel_attr("value", "b"), # value = 'b' color = "#f4a717" )$show_css()
A good way to conceptualise the
%child%
operator is to think of it like one uses the pipe in the rvest package or how one might use the pipe in purrr: to gradually but surely go down the tree until the right node is selected.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.