Skip to content
This repository has been archived by the owner. It is now read-only.
A toolbox of functions for easier shiny development.
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
data-raw
man
tests
CODE_OF_CONDUCT.md
DESCRIPTION
LICENSE
LICENSE.md
NAMESPACE
NEWS.md
README.Rmd
README.md
brighter.Rproj

README.md

NOTES

All these functions has moved to {golem}.

brighter

{brighter} is a toolbox of random functions for easier shiny development.

library(brighter)

Installation

You can install the dev version of brighter from GitHub with:

remotes::install_github("Thinkr-open/brighter")

List of functions

with_red_star

Adds a red star at the end of the text (for example for indicating mandatory fields).

with_red_star("Plop")
<span>Plop<span style="color:red">*</span></span>

enurl

Takes an url and a text and create a link:

enurl("https://www.thinkr.fr", "ThinkR")
<a href="https://www.thinkr.fr">ThinkR</a>

rep_br

Repeat a tags$br n times

rep_br(times = 3)
<br/> <br/> <br/>

list_to_li & list_to_p

Turns an R list to an HTML list or into paragraphs.

list_to_li(c("a","b"))
<li>a</li>
<li>b</li>

You can add a class to each with the class parameters.

list_to_p(c("One","Two"), class = "pouet")
<p class="pouet">One</p>
<p class="pouet">Two</p>

named_to_li

Turn a named vector into a named html list:

pouet <- c("One", "two", "three")
names(pouet) <- c("a", "b", "c")

named_to_li(pouet)
<li><b>a:</b> One</li>
<li><b>b:</b> two</li>
<li><b>c:</b> three</li>

You can also pass a class:

named_to_li(pouet, class = "this")
<li class="this"><b>a:</b> One</li>
<li class="this"><b>b:</b> two</li>
<li class="this"><b>c:</b> three</li>

tagRemoveAttributes

Does the opposite of tagAppendAttributes

a <- tags$p(src = "plop", style = "this", "pouet")

a
<p src="plop" style="this">pouet</p>

tagRemoveAttributes(a, "src")
<p style="this">pouet</p>

tagRemoveAttributes(a, "src", "style")
<p>pouet</p>

display and undisplay

Put and remove a div to and from a <span style="display: none;">. Allow to dynamically show and hide content.

a <- shiny::tagAppendAttributes(
  shiny::tags$a("pouet"), 
  style = "align: center;")
b <- undisplay(a)
b
<span style="display: none;">
  <a style="align: center;">pouet</a>
</span>
  
display(b)
<a style="align: center;">pouet</a>

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

You can’t perform that action at this time.