shuffle_options: Options for Shuffle

Description Usage Arguments Examples

View source: R/tags.R

Description

Options for Shuffle

Usage

1
2
3
4
5
6
7
8
shuffle_options(
  is_centered = NULL,
  column_width = NULL,
  gutter_width = NULL,
  speed = NULL,
  easing = NULL,
  ...
)

Arguments

is_centered

Attempt to center grid items in each row.

column_width

A static number or function that returns a number which tells the plugin how wide the columns are (in pixels). If function use I() to treat as literal JavaScript.

gutter_width

A static number or function that tells the plugin how wide the gutters between columns are (in pixels). If function use I() to treat as literal JavaScript.

speed

Transition/animation speed (milliseconds).

easing

CSS easing function to use, for example: 'ease' or 'cubic-bezier(0.680, -0.550, 0.265, 1.550)'.

...

Additional arguments, see https://vestride.github.io/Shuffle/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
if (interactive()) {
  library(shiny)
  library(shufflecards)
  library(ggplot2)


  ui <- fluidPage(
    tags$h2("Responsive Shuffle Grid"),
    fluidRow(
      column(
        width = 12,
        shuffle_container(
          shuffleId = "grid",
          options = shuffle_options(
            is_centered = FALSE,
            column_width = I("function(containerWidth) {return 0.49 * containerWidth;}"),
            gutter_width = I("function(containerWidth) {return 0.01 * containerWidth;}")
          ),
          shuffle_card(
            plotOutput(outputId = "plot1"), width = "49%"
          ),
          shuffle_card(
            plotOutput(outputId = "plot2"), width = "49%"
          ),
          shuffle_card(
            plotOutput(outputId = "plot3"), width = "49%"
          )
        )
      )
    )
  )

  server <- function(input, output, session) {

    output$plot1 <- renderPlot({
      ggplot() + geom_text(aes(1, 1, label = 1), size = 50)
    })
    output$plot2 <- renderPlot({
      ggplot() + geom_text(aes(1, 1, label = 2), size = 50)
    })
    output$plot3 <- renderPlot({
      ggplot() + geom_text(aes(1, 1, label = 3), size = 50)
    })

  }

  shinyApp(ui, server)
}

dreamRs/shufflecards documentation built on Dec. 4, 2019, 4:44 a.m.