sd_ui function

Create the UI for a surveydown survey

Create the UI for a surveydown survey

This function creates the user interface for a surveydown survey, including necessary CSS and JavaScript files, and applies custom styling. It retrieves theme and progress bar settings from the survey.qmd file.

sd_ui()

Returns

A 'shiny' UI object

Details

The function reads the following settings from the survey.qmd YAML header:

  • theme: The theme to be applied to the survey.
  • barcolor: The color of the progress bar (should be a valid hex color).
  • barposition: The position of the progress bar ('top', 'bottom', or 'none').

If barcolor is not specified or is NULL, the default theme color will be used. If barposition is not specified, it defaults to 'top'.

Examples

if (interactive()) { library(surveydown) # Get path to example survey file survey_path <- system.file("examples", "sd_ui.qmd", package = "surveydown") # Copy to a temporary directory temp_dir <- tempdir() file.copy(survey_path, file.path(temp_dir, "survey.qmd")) orig_dir <- getwd() setwd(temp_dir) # Define a minimal server server <- function(input, output, session) { sd_server() } # Run the app shiny::shinyApp(ui = sd_ui(), server = server) # Clean up setwd(orig_dir) }

See Also

sd_server() for creating the server-side logic of the survey

  • Maintainer: John Paul Helveston
  • License: MIT + file LICENSE
  • Last published: 2025-04-17