Package 'litter'

Title: 'Lit' Components for 'Shiny'
Description: 'Lit' components for 'Shiny'.
Authors: John Coene [aut, cre]
Maintainer: John Coene <[email protected]>
License: GPL (>= 3)
Version: 0.0.1.9000
Built: 2024-10-31 04:50:35 UTC
Source: https://github.com/devOpifex/litter

Help Index


Default Global Color

Description

Default Global Color

Usage

lit_default_color()

Lit Action Button

Description

Create an action button.

Usage

litActionButton(
  name = "",
  content = "Click me",
  ...,
  id = NULL,
  class = NULL,
  value = NULL,
  callback = NULL,
  send_on_render = FALSE
)

Arguments

name

Name of the input.

content

Content of the button, a character string or valid shiny::tags.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

value

Value of the input.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.

Examples

library(shiny)

ui <- fluidPage(
	litActionButton(
		"btn",
		"First btn"
	),
	litActionButton(
		"btn",
		"Second btn"
	)
)

server <- function(input, output, session){
	observeEvent(input$btn, {
		print(input$btn)
	})
}

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

Lit Checkboxes Input

Description

Create checkboxes input.

Usage

litCheckboxesInput(
  name = "",
  choices = list(),
  ...,
  id = NULL,
  value = list(),
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

choices

List of options.

...

Passed to props.

id

Id of the input.

value

choices that are checked.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Color Input

Description

Create a color input.

Usage

litColorInput(
  name = "",
  value = "",
  placeholder = "",
  ...,
  id = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

value

Value of the input.

placeholder

Placeholder text.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render


Lit Datalist Input

Description

Create a datalist input.

Usage

litDatalistInput(
  name = "",
  choices = list(),
  ...,
  id = NULL,
  value = NULL,
  class = NULL,
  placeholder = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

choices

List of options.

...

Passed to props.

id

Id of the input.

value

Value of the input.

class

Any additional classes.

placeholder

Placeholder value.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.

Details

Can be server-side rendered with update_datalist_input().

See Also

update_datalist_input()


Lit Filter Input

Description

Create a filter input.

Usage

litFilterInput(
  name = "",
  ...,
  dataset = NULL,
  id = NULL,
  value = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

...

Passed to props.

dataset

Dataset to retrieve variables.

id

Id of the input.

value

Value of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Password Input

Description

Create a password input.

Usage

litPasswordInput(
  name = "",
  value = "",
  placeholder = "",
  ...,
  id = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE,
  send_on = c("deferred", "enter")
)

Arguments

name

Name of the input.

value

Value of the input.

placeholder

Placeholder text.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.

send_on

Whether to send the input when the user hits the enter key or to send it in a deferred manner.


Lit Radio Input

Description

Create radio input.

Usage

litRadioInput(
  name = "",
  choices = list(),
  ...,
  id = NULL,
  value = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

choices

List of options.

...

Passed to props.

id

Id of the input.

value

choices that are checked.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Range Input

Description

Create a range input.

Usage

litRangeInput(
  name = "",
  ...,
  id = NULL,
  min = 0L,
  max = 10L,
  step = NULL,
  value = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

...

Passed to props.

id

Id of the input.

min, max, value

Minimum, maximum, and initial value of the range.

step

Incremental steps the range must take.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.

Examples

library(shiny)

ui <- fluidPage(
  litRangeInput("range")
)

server <- function(input, output, session){
  observeEvent(input$range, {
    print(input$range)
  })
}

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

Lit Select Input

Description

Create a select input.

Usage

litSelectInput(
  name = "",
  choices = list(),
  ...,
  id = NULL,
  value = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

choices

List of options.

...

Passed to props.

id

Id of the input.

value

Value of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Selectize Input

Description

Create a selectize input.

Usage

litSelectizeInput(
  name = "",
  choices = list(),
  ...,
  id = NULL,
  value = list(),
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

choices

List of options.

...

Passed to props.

id

Id of the input.

value

Value of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Switch Input

Description

Create a switch input.

Usage

litSwitchInput(
  name = "",
  value = TRUE,
  label = "",
  ...,
  id = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

value

Value of the input.

label

Label of the button.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Text Area Input

Description

Create a text area input.

Usage

litTextAreaInput(
  name = "",
  value = "",
  placeholder = "",
  ...,
  id = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE
)

Arguments

name

Name of the input.

value

Value of the input.

placeholder

Placeholder text.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.


Lit Text Input

Description

Create a text input.

Usage

litTextInput(
  name = "",
  value = "",
  placeholder = "",
  ...,
  id = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE,
  send_on = c("deferred", "enter")
)

Arguments

name

Name of the input.

value

Value of the input.

placeholder

Placeholder text.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on connect.

send_on

Whether to send the input when the user hits the enter key or to send it in a deferred manner.


Lit Text Label Input

Description

Create a text input with a floating label.

Usage

litTextLabelInput(
  name = "",
  label,
  value = "",
  placeholder = label,
  ...,
  id = NULL,
  class = NULL,
  callback = NULL,
  send_on_render = TRUE,
  send_on = c("deferred", "enter")
)

Arguments

name

Name of the input.

label

Label of the input.

value

Value of the input.

placeholder

Placeholder text.

...

Passed to props.

id

Id of the input.

class

Any additional classes.

callback

A JavaScript callback functions that accepts one argument.

send_on_render

Whether to send the input value on render.

send_on

Whether to send the input when the user hits the enter key or to send it in a deferred manner.


Lit Toggler Input

Description

Create an input that is initially hidden but revealed on click. This hijacks the original input which no longer sends values to the server.

Usage

litTogglerInput(name, display, input, ..., callback = NULL, restore = TRUE)

Arguments

name

Name of the input.

display

The content to display.

input

The input to reveal.

...

Passed to props.

callback

A JavaScript callback functions that accepts one argument.

restore

Whether to set the input value to the display text and vice versa.

Details

This can be updated with the feedback argument in update_input() as well as accept, a boolean to indicate whether to accept the value set.


Update inputs

Description

Update inputs.

Usage

update_input(
  ...,
  name = NULL,
  id = NULL,
  selector = NULL,
  session = shiny::getDefaultReactiveDomain()
)

update_datalist_input(
  choices,
  ...,
  name = NULL,
  id = NULL,
  selector = NULL,
  session = shiny::getDefaultReactiveDomain()
)

update_selectize_input(
  choices,
  ...,
  name = NULL,
  id = NULL,
  selector = NULL,
  session = shiny::getDefaultReactiveDomain()
)

update_filter_input(
  dataset,
  ...,
  name = NULL,
  id = NULL,
  selector = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

...

Props to update, e.g.: value.

name

Name of the input.

id

Id of the input.

selector

A CSS selector.

session

A Shiny session.

choices

Vector (optionally named) of options.

dataset

Dataset to update litDatalistInput()

Details

Set either of name, id, or selector. The function update_datalist_input() is used to server-side render the options.