• Stars
    star
    186
  • Rank 198,571 (Top 5 %)
  • Language
    R
  • License
    Other
  • Created over 10 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Various UI widgets/components not part of Shiny e.g. alerts, styled buttons

ShinySky

Various UI widgets/components used by AnalytixWare's flagship product e.g. alerts, styled buttons

alt text

Install

To install the latest version

if (require(devtools)) install.packages("devtools")#if not already installed
devtools::install_github("AnalytixWare/ShinySky")

Quick Start

Simply the run the examples and take a look at the code included inside the example Shiny app

library(shinysky)
shinysky::run.shinysky.example()

Usage

library(shinysky)

Action Buttons

actionButton(inputId, label, styleclass = yourStyle)

Specify the style with the styleclass argument. The possible styles are "primary", "info", "success", "warning", "danger", "inverse", "link", ""

Alerts

ui.R

shinyalert(id, click.hide = TRUE, auto.close.after = NULL)

In the past clicking on the alert will hide it. Setting click.hide = FALSE can prevent this behaviour The auto.close.after can take a number and will close the alert after this many seconds.

Simply provide an id. The alert will be hidden until you show it using showshinyalert in server.R

server.R

showshinyalert(session,id,HTMLtext,styleclass)

Put some valid HTML in HTMLtext. Here you can specify the style you want using the styleclass parameter. The possible styles are "primary", "info", "success", "warning", "danger", "inverse", "link", ""

Select2

The below will create a multiple select2 with "a", "b", "c" as choices

select2Input("select2Input1","This is a multiple select2Input",choices=c("a","b","c"),selected=c("b","a"))

Video Demo

Video Demo

Typeahead Text Input

textInput.typeahead(
    id="thti"
    ,placeholder="type 'name' or '2'"
    ,local=data.frame(name=c("name1","name2"),info=c("info1","info2"))
    ,valueKey = "name"
    ,tokens=c(1,2)
    ,template = HTML("<p class='repo-language'>{{info}}</p> <p class='repo-name'>{{name}}</p> <p class='repo-description'>You need to learn more CSS to customize this further</p>")
  )

Busy Indicator

ui.R

busyIndicator(wait = 1000)

Here the wait determines how long to wait before showing the buys indicator. The default is wait=1000, which is one second. This is to prevent short computation triggering the busyIndicator.

Events Buttons

eventsButton(inputId, label, events = c("dblclick"))

This button will invalidate (become dirty) upon the events. The event does not have to be a "click", in fact the default is dblclick. You can specify multiple events. For a list of event types See: http://api.jquery.com/category/events/mouse-events/

Handsontable Input/Output

ui.R

hotable("hotable1")

This will create a handsontable which you can output using

output$hotable1 <- renderHotable({...})

server.R

something <- reactive({
	hot.to.df(input$hotable1) # this will convert your input into a data.frame
})

Do you need help with Shiny?

Contact me on Codementor

I am available for Shiny consulting! Email me to get 10% discount off the hourly rate.