An open API service indexing awesome lists of open source software.

https://github.com/ThinkR-open/brighter

A toolbox of functions for easier shiny development.
https://github.com/ThinkR-open/brighter

Last synced: 4 months ago
JSON representation

A toolbox of functions for easier shiny development.

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# brighter

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

```{r}
library(brighter)
```

## Installation

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

``` r
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")
Plop*
```

### `enurl`

Takes an url and a text and create a link:

```
enurl("https://www.thinkr.fr", "ThinkR")
ThinkR
```

### `rep_br`

Repeat a `tags$br` n times

```
rep_br(times = 3)




```

### `list_to_li` & `list_to_p`

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

```
list_to_li(c("a","b"))

  • a

  • b

  • ```

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

    ```
    list_to_p(c("One","Two"), class = "pouet")

    One


    Two


    ```

    ### `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)


  • a: One


  • b: two


  • c: three

  • ```

    You can also pass a class:

    ```
    named_to_li(pouet, class = "this")


  • a: One


  • b: two


  • c: three

  • ```

    ### `tagRemoveAttributes`

    Does the opposite of tagAppendAttributes

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

    a

    pouet

    tagRemoveAttributes(a, "src")

    pouet

    tagRemoveAttributes(a, "src", "style")

    pouet


    ```

    ### `display` and `undisplay`

    Put and remove a div to and from a ``. Allow to dynamically show and hide content.

    ```
    a <- shiny::tagAppendAttributes(
    shiny::tags$a("pouet"),
    style = "align: center;")
    b <- undisplay(a)
    b

    pouet


    display(b)
    pouet
    ```

    Please note that the 'brighter' project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.