Skip to content

Commit

Permalink
rewrote pretty examples and changed update defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed May 18, 2020
1 parent e0f4def commit f33ec7e
Show file tree
Hide file tree
Showing 21 changed files with 1,218 additions and 943 deletions.
846 changes: 141 additions & 705 deletions R/input-pretty.R

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions examples/prettyCheckbox.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
library(shiny)
library(shinyWidgets)

ui <- fluidPage(
tags$h1("Pretty checkbox"),
br(),

fluidRow(
column(
width = 4,
prettyCheckbox(
inputId = "checkbox1",
label = "Click me!"
),
verbatimTextOutput(outputId = "res1"),
br(),
prettyCheckbox(
inputId = "checkbox4",
label = "Click me!",
outline = TRUE,
plain = TRUE,
icon = icon("thumbs-up")
),
verbatimTextOutput(outputId = "res4")
),
column(
width = 4,
prettyCheckbox(
inputId = "checkbox2",
label = "Click me!",
thick = TRUE,
animation = "pulse",
status = "info"
),
verbatimTextOutput(outputId = "res2"),
br(),
prettyCheckbox(
inputId = "checkbox5",
label = "Click me!",
icon = icon("check"),
animation = "tada",
status = "default"
),
verbatimTextOutput(outputId = "res5")
),
column(
width = 4,
prettyCheckbox(
inputId = "checkbox3",
label = "Click me!",
shape = "round",
status = "danger",
fill = TRUE,
value = TRUE
),
verbatimTextOutput(outputId = "res3")
)
)

)

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

output$res1 <- renderPrint(input$checkbox1)
output$res2 <- renderPrint(input$checkbox2)
output$res3 <- renderPrint(input$checkbox3)
output$res4 <- renderPrint(input$checkbox4)
output$res5 <- renderPrint(input$checkbox5)

}

if (interactive())
shinyApp(ui, server)




# Inline example ----

ui <- fluidPage(
tags$h1("Pretty checkbox: inline example"),
br(),
prettyCheckbox(
inputId = "checkbox1",
label = "Click me!",
status = "success",
outline = TRUE,
inline = TRUE
),
prettyCheckbox(
inputId = "checkbox2",
label = "Click me!",
thick = TRUE,
shape = "curve",
animation = "pulse",
status = "info",
inline = TRUE
),
prettyCheckbox(
inputId = "checkbox3",
label = "Click me!",
shape = "round",
status = "danger",
value = TRUE,
inline = TRUE
),
prettyCheckbox(
inputId = "checkbox4",
label = "Click me!",
outline = TRUE,
plain = TRUE,
animation = "rotate",
icon = icon("thumbs-up"),
inline = TRUE
),
prettyCheckbox(
inputId = "checkbox5",
label = "Click me!",
icon = icon("check"),
animation = "tada",
status = "primary",
inline = TRUE
),
verbatimTextOutput(outputId = "res")
)

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

output$res <- renderPrint(
c(input$checkbox1,
input$checkbox2,
input$checkbox3,
input$checkbox4,
input$checkbox5)
)

}

if (interactive())
shinyApp(ui, server)

79 changes: 79 additions & 0 deletions examples/prettyCheckboxGroup.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
library(shiny)
library(shinyWidgets)

ui <- fluidPage(
tags$h1("Pretty checkbox group"),
br(),

fluidRow(
column(
width = 4,
prettyCheckboxGroup(
inputId = "checkgroup1",
label = "Click me!",
choices = c("Click me !", "Me !", "Or me !")
),
verbatimTextOutput(outputId = "res1"),
br(),
prettyCheckboxGroup(
inputId = "checkgroup4",
label = "Click me!",
choices = c("Click me !", "Me !", "Or me !"),
outline = TRUE,
plain = TRUE,
icon = icon("thumbs-up")
),
verbatimTextOutput(outputId = "res4")
),
column(
width = 4,
prettyCheckboxGroup(
inputId = "checkgroup2",
label = "Click me!",
thick = TRUE,
choices = c("Click me !", "Me !", "Or me !"),
animation = "pulse",
status = "info"
),
verbatimTextOutput(outputId = "res2"),
br(),
prettyCheckboxGroup(
inputId = "checkgroup5",
label = "Click me!",
icon = icon("check"),
choices = c("Click me !", "Me !", "Or me !"),
animation = "tada",
status = "default"
),
verbatimTextOutput(outputId = "res5")
),
column(
width = 4,
prettyCheckboxGroup(
inputId = "checkgroup3",
label = "Click me!",
choices = c("Click me !", "Me !", "Or me !"),
shape = "round",
status = "danger",
fill = TRUE,
inline = TRUE
),
verbatimTextOutput(outputId = "res3")
)
)

)

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

output$res1 <- renderPrint(input$checkgroup1)
output$res2 <- renderPrint(input$checkgroup2)
output$res3 <- renderPrint(input$checkgroup3)
output$res4 <- renderPrint(input$checkgroup4)
output$res5 <- renderPrint(input$checkgroup5)

}

if (interactive())
shinyApp(ui, server)

78 changes: 78 additions & 0 deletions examples/prettyRadioButtons.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
library(shiny)
library(shinyWidgets)

ui <- fluidPage(
tags$h1("Pretty radio buttons"),
br(),

fluidRow(
column(
width = 4,
prettyRadioButtons(
inputId = "radio1",
label = "Click me!",
choices = c("Click me !", "Me !", "Or me !")
),
verbatimTextOutput(outputId = "res1"),
br(),
prettyRadioButtons(
inputId = "radio4",
label = "Click me!",
choices = c("Click me !", "Me !", "Or me !"),
outline = TRUE,
plain = TRUE,
icon = icon("thumbs-up")
),
verbatimTextOutput(outputId = "res4")
),
column(
width = 4,
prettyRadioButtons(
inputId = "radio2",
label = "Click me!",
thick = TRUE,
choices = c("Click me !", "Me !", "Or me !"),
animation = "pulse",
status = "info"
),
verbatimTextOutput(outputId = "res2"),
br(),
prettyRadioButtons(
inputId = "radio5",
label = "Click me!",
icon = icon("check"),
choices = c("Click me !", "Me !", "Or me !"),
animation = "tada",
status = "default"
),
verbatimTextOutput(outputId = "res5")
),
column(
width = 4,
prettyRadioButtons(
inputId = "radio3",
label = "Click me!",
choices = c("Click me !", "Me !", "Or me !"),
shape = "round",
status = "danger",
fill = TRUE,
inline = TRUE
),
verbatimTextOutput(outputId = "res3")
)
)

)

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

output$res1 <- renderPrint(input$radio1)
output$res2 <- renderPrint(input$radio2)
output$res3 <- renderPrint(input$radio3)
output$res4 <- renderPrint(input$radio4)
output$res5 <- renderPrint(input$radio5)

}

if (interactive())
shinyApp(ui, server)
53 changes: 53 additions & 0 deletions examples/prettySwitch.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
library(shiny)
library(shinyWidgets)

ui <- fluidPage(
tags$h1("Pretty switches"),
br(),

fluidRow(
column(
width = 4,
prettySwitch(inputId = "switch1", label = "Default:"),
verbatimTextOutput(outputId = "res1"),
br(),
prettySwitch(
inputId = "switch4",
label = "Fill switch with status:",
fill = TRUE, status = "primary"
),
verbatimTextOutput(outputId = "res4")
),
column(
width = 4,
prettySwitch(
inputId = "switch2",
label = "Danger status:",
status = "danger"
),
verbatimTextOutput(outputId = "res2")
),
column(
width = 4,
prettySwitch(
inputId = "switch3",
label = "Slim switch:",
slim = TRUE
),
verbatimTextOutput(outputId = "res3")
)
)

)

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

output$res1 <- renderPrint(input$switch1)
output$res2 <- renderPrint(input$switch2)
output$res3 <- renderPrint(input$switch3)
output$res4 <- renderPrint(input$switch4)

}

if (interactive())
shinyApp(ui, server)
Loading

0 comments on commit f33ec7e

Please sign in to comment.