Skip to contents

Create a Framework7 color picker input

Usage

f7ColorPicker(
  inputId,
  label,
  value = "#ff0000",
  placeholder = NULL,
  modules = f7ColorPickerModules,
  palettes = f7ColorPickerPalettes,
  sliderValue = TRUE,
  sliderValueEditable = TRUE,
  sliderLabel = TRUE,
  hexLabel = TRUE,
  hexValueEditable = TRUE,
  groupedModules = TRUE,
  style = list(outline = FALSE, inset = FALSE, strong = FALSE, dividers = FALSE),
  ...
)

Arguments

inputId

Color picker input.

label

Color picker label.

value

Initial picker value in hex.

placeholder

Color picker placeholder.

modules

Picker color modules. Choose at least one.

palettes

Picker color predefined palettes. Must be a list of color vectors, each value specified as HEX string.

sliderValue

When enabled, it will display sliders values.

sliderValueEditable

When enabled, it will display sliders values as elements to edit directly.

sliderLabel

When enabled, it will display sliders labels with text.

hexLabel

When enabled, it will display HEX module label text, e.g. HEX.

hexValueEditable

When enabled, it will display HEX module value as element to edit directly.

groupedModules

When enabled it will add more exposure to sliders modules to make them look more separated.

style

Input style. Inherit from f7List options such as outline, inset, strong and dividers.

...

Other options to pass to the picker. See https://framework7.io/docs/color-picker#color-picker-parameters.

Value

The return value is a list and includes hex, rgb, hsl, hsb, alpha, hue, rgba, and hsla values. See https://framework7.io/docs/color-picker#color-picker-value.

Examples

library(shiny)
library(shinyMobile)

app <- shinyApp(
  ui = f7Page(
    title = "My app",
    f7SingleLayout(
      navbar = f7Navbar(title = "f7ColorPicker"),
      f7ColorPicker(
        inputId = "mycolorpicker",
        placeholder = "Some text here!",
        label = "Select a color"
      ),
      "The picker hex value is:",
      textOutput("colorPickerVal"),
      "The picker rgb value is:",
      textOutput("colorPickerValRgb")
    )
  ),
  server = function(input, output) {
    output$colorPickerVal <- renderText(input$mycolorpicker$hex)
    output$colorPickerValRgb <- renderText(unlist(paste(input$mycolorpicker$rgb, collapse = ",")))
  }
)

if (interactive() || identical(Sys.getenv("TESTTHAT"), "true")) app