Ok, looks my question was too stupid or too complex, so let me try again with a simplified version. See comments in example below. Save code as an Rmd-file to run it.
---
title: "How to use Shiny responses in learnr"
output: learnr::tutorial
runtime: shiny_prerendered
---
```{r context="setup", include=FALSE}
library(learnr)
# Not used.....
custom_checker = function(label, user_code, check_code, envir_result, evaluate_result, last_value, stage, ...) {
print("stage")
if (stage == "code_check")
return(list("Not this", correct = FALSE))
}
tutorial_options(exercise.checker = custom_checker)
```
## Topic 1
### Using Shiny
I know that I can do THIS with `learnr` standard tools (see next page), but let's take it as a simple example for a custom Shiny question.
There is an [example in the Shiny documentation](https://pkgs.rstudio.com/learnr/articles/learnr.html#shiny-components), which explains how shiny components are shown, but not how they are used.
This [link on community](https://community.rstudio.com/t/incorporating-shiny-with-learnr-modules/79827/3) is interesting, but also does not show how to use
```{r, context="render", echo=FALSE}
radioButtons("choose", "Select <<good>> as correct",
c("bad", "ugly", "good"))
```
Button 'Next topic' should only be visible when answer is correct
```{r, context="server"}
observeEvent(input$choose, {
shiny::showNotification(input$choose)
})
```
## Topic 2
### The usual way
```{r good-bad, echo = FALSE}
question(
"Pick good",
answer("bad"),
answer("good", correct = TRUE),
answer("ugly"),
allow_retry = TRUE,
random_answer_order = TRUE
)