Skip to contents

Sets up server-side logic for displaying survey responses in a themed DataTable. Handles rendering, visibility control, and theme-based styling.

Usage

server_response(
  output,
  rv,
  show_response = TRUE,
  theme_mode = "light",
  theme_color = "#003594"
)

Arguments

output

Shiny output object.

rv

Reactive values object containing:

  • survey_completed: Boolean indicating survey completion

  • loading: Boolean for loading state

  • survey_responses: Data frame of responses

  • error_message: Error message string if any

show_response

Logical. Display response table. Default: FALSE.

theme_mode

String. Color mode, either "light" or "dark". Default: "light".

theme_color

String. Hex color code for primary theme.

Details

Creates two reactive outputs:

  • surveyResponseTable: Themed DataTable of responses

  • showResponseTable: Visibility control

Table displays when:

  • Survey is completed

  • Not loading

  • No errors present

  • show_response is TRUE

Theme styling:

  • Light mode: White background, dark text

  • Dark mode: Dark background, light text

Examples

if (FALSE) { # \dontrun{
server <- function(input, output, session) {
  rv <- reactiveValues(
    survey_completed = FALSE,
    loading = FALSE,
    survey_responses = data.frame(),
    error_message = NULL
  )

  server_response(
    output,
    rv,
    show_response = TRUE,
    theme_mode = "light",
    theme_color = "#003594"
  )
}
} # }