% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/survey_module.R
\name{survey_module_ui}
\alias{survey_module_ui}
\title{Shiny module UI for an embedded survey}
\usage{
survey_module_ui(id, width = "100\%")
}
\arguments{
\item{id}{A character string. The module namespace ID, passed identically
to \code{\link[=survey_module_server]{survey_module_server()}}.}

\item{width}{Character. CSS width for the survey card. Defaults to
\code{"100\%"}.}
}
\value{
A \code{shiny.tag} object.
}
\description{
Places a survey rendered by surveyframe inside a larger Shiny application.
Pair with \code{\link[=survey_module_server]{survey_module_server()}} in the server function. The module
renders the full instrument including welcome page, all item types,
branching logic, required-field validation, and a thank-you screen.
}
\examples{
\donttest{
# Minimal embedding example:
library(shiny)
library(surveyframe)

cs    <- sf_choices("ag5", 1:5, c("SD", "D", "N", "A", "SA"))
item  <- sf_item("q1", "Rate your experience.", type = "likert",
                 choice_set = "ag5", required = TRUE)
instr <- sf_instrument("Quick Survey", components = list(cs, item))

ui <- fluidPage(
  survey_module_ui("demo"),
  verbatimTextOutput("result")
)

server <- function(input, output, session) {
  resp <- survey_module_server("demo", instrument = instr)
  output$result <- renderPrint({
    req(resp())
    resp()
  })
}

shinyApp(ui, server)
}
}
\seealso{
\code{\link[=survey_module_server]{survey_module_server()}}, \code{\link[=launch_studio]{launch_studio()}},
\code{\link[=export_static_survey]{export_static_survey()}}
}
