render_survey: Render a survey from an instrument object

View source: R/render_survey.R

render_surveyR Documentation

Render a survey from an instrument object

Description

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.

See Also

launch_studio(), read_responses()

Examples


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"))


surveyframe documentation built on July 25, 2026, 1:07 a.m.