Skip to contents

Launches a Shiny survey with a welcome page, configurable header, all item types, branching logic, required-field enforcement, progress tracking, standard and conversational (one-question-at-a-time) display modes, and a customisable thank-you page. Responses can be persisted to CSV or passed to a callback.

Usage

render_survey(
  instrument,
  mode = c("shiny"),
  title = NULL,
  theme = NULL,
  save_responses = c("none", "csv"),
  output_path = NULL,
  on_submit = NULL
)

Arguments

instrument

An sframe object.

mode

Character. Deployment mode. Currently "shiny".

title

Character or NULL. Override for the survey title.

theme

Character or NULL. Hex colour for the survey theme.

save_responses

Character. "none" (default) or "csv".

output_path

Character or NULL. CSV path when save_responses = "csv".

on_submit

Function or NULL. Callback receiving the submitted row.

Value

A shiny.appobj.

Examples

# \donttest{
cs    <- sf_choices("ag5", 1:5,
           c("Strongly disagree", "Disagree", "Neutral",
             "Agree", "Strongly agree"))
item  <- sf_item("sat_1", "How satisfied are you?",
                 type = "likert", choice_set = "ag5")
instr <- sf_instrument("My Survey", components = list(cs, item))
app <- render_survey(instr)
app <- render_survey(instr, save_responses = "csv", output_path = tempfile(fileext = ".csv"))
# }