Learn R Programming

⚠️There's a newer version (0.0.4) of this package.Take me there.

dqshiny

The goal of dqshiny is to provide highly customizable modules to enhance your shiny apps. Includes layout independent collapsable boxes and value boxes, a very fast autocomplete input, rhandsontable extensions for filtering and paging and much more.

Installation

dqshiny is on CRAN so it can be installed with:

install.packages("dqshiny")

You can install the latest development version of dqshiny using:

remotes::install_github("daqana/dqshiny")

Example

There’s a package demo dqshiny-base-features demonstrating some functionalities. Or you can start with this short example to see some simple boxes in action:

library(shiny)
library(dqshiny)
shinyApp(
  ui = fluidPage(
    fluidRow(
      dq_box(
        title = "Say Hello to my children", collapsed = TRUE, fill = FALSE,
        dq_infobox("Hello", 2, "World", icon("hashtag"), bg_color = "black", color = "#D00"),
        dq_box(title = "Box in the box", bg_color = "red", width = 8, dq_space())
      )
    )
  ),
  server = function(input, output) {}
)

If you have a bigger amount of selectable choices and still don’t want to use textInputs you may have a look at this:

library(shiny)
library(dqshiny)
# create 100k random words
opts <- sapply(1:100000, function(i) paste0(sample(letters, 7), collapse=""))
shinyApp(
  ui = fluidPage(
    fluidRow(
      column(3,
        autocomplete_input("auto1", "Unnamed:", opts, max_options = 1000),
        autocomplete_input("auto2", "Named:", max_options = 1000,
          structure(opts, names = opts[order(opts)]))
        # feel free to test this with select... and may get yourself a coffee
        # , selectInput("sel", "Select:", opts)
      ), column(3,
        tags$label("Value:"), verbatimTextOutput("val1", placeholder = TRUE),
        tags$label("Value:"), verbatimTextOutput("val2", placeholder = TRUE)
      )
    )
  ),
  server = function(input, output) {
    output$val1 <- renderText(as.character(input$auto1))
    output$val2 <- renderText(as.character(input$auto2))
  }
)

If you ever encountered the wish to have a paged or filtered rHandsontable, this example could be quite interesting:

library(shiny)
library(dqshiny)
shinyApp(
  ui = fluidPage(dq_handsontable_output("myTable", 9L)),
  server = function(input, output, session) {
    hw <- c("Hello", "my", "funny", "world!")
    data <- data.frame(A = rep(hw, 500L), B = hw[c(2:4, 1L)], C = 1:500, D = 500:1)
    dq_render_handsontable("myTable", data,
      filters = c("Sel", "Text", NA, "Auto"), sorting = TRUE,
      page_size = c(17L, 5L, 500L, 1000L),
      col_param = list(list(col = 3L, format = "0.00")),
      cell_param = list(list(row = 2:9, col = 2L, readOnly = TRUE))
    )
  }
)

Copy Link

Version

Install

install.packages('dqshiny')

Monthly Downloads

12

Version

0.0.3

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Richard Kunze

Last Published

February 5th, 2019

Functions in dqshiny (0.0.3)

render_dq_box_group

Directly render a set of dq_boxes as a group
dq_accordion

Accordion module to show several collapsible boxes
dqshiny

dqshiny: Enhance Shiny Apps with Customizable Modules
render_hot

Function to (re)render an existing rhandsontable
dq_icon

Creates an icon element
init

Initializes dqshiny
dq_htmltable

Create a HTML table containing the given list of elements
icon_state_button

Creates a state button showing different icons
dq_hot_cell

Configure individual cells of rhandsontable widget
dq_hot_date_renderer

rhandsontable renderer
dq_busy

Adds a loading image if shiny is busy
enable

Change the state of a shiny interface element
reset_slider_input

Function to reset a slider input
add_js

Adds a custom JS function
init_fonts

Initializes dqshiny fonts for figures
time_input

Creates a time input field
text_filter

text filter for data.frames
range_filter

numeric range filter for data.frames
video_box

Adds a video box to the app
dq_helptag

Creates a help symbol with the given title as popover
dq_render_svg

Render ggplot2 figure as svg
dq_space

Create an empty div for spacing
hidden

Sets the initial state of all given tags
hide

Change the state of a shiny interface element
create_dq_box_group

Create a dq box group
dq_add_selectize_options

Adds selectizeOptions to a column of rhandsontable
autocomplete_input

Creates an autocomplete text input field
dq_box

Creates a html box with specified parameters
click

Programmatically click a button
add_class

Change the state of a shiny interface element
dq_infobox

Creates an info box with given texts
dq_handsontable_output

Adds an uiOutput and renders an enhanced rhandsontable html widget