Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sliderTextInput compatibility problem on Quarto doc in the argument choices. #689

Open
pingfan-hu opened this issue Apr 15, 2024 · 2 comments

Comments

@pingfan-hu
Copy link

pingfan-hu commented Apr 15, 2024

ShinyApp Works Fine

The sliderTextInput function works out fine on ShinyApp, like this:

sliderTextInput(
   inputId = "Id095",
   label = "Choose a letter:", 
   choices = c("a", "b", "c", "d", "e")
)

Quarto Doc Not Compatible

However, it has compatibility problem on Quarto doc. The choices argument should be used to define the character vector to select a value from, but Quarto doc doesn't recognizes it and keeps showing a default range from 10 to 100, not matter what range I set, or if I use character vector instead.

Below is my example (you can paste these codes into a blank quarto doc and reproduce it):

---
title: "Slider Text Input Example"
format: html
server: shiny
execute: 
  warning: false
---

```{r}
library(shiny)
library(shinyWidgets)
sliderTextInput("Id095", "Choose a letter:",
                choices = c("a", "b", "c", "d", "e"))
textOutput("selected_letter")
```

```{r}
#| context: server
output$selected_letter <- renderText({
  paste("You have selected the letter:", input$Id095)
})
```

Screenshots

Here is a screenshot of a successful implementation on the ShinyApp:
ShinyApp Works Fine

Here is another screenshot of Quarto Doc. You can see the range is set as from 10 to 100, which is probably a default value. I tried to set a custom range with a character vector but it was ignored:
Quarto Doc Has Error on the Range

If anyone encountered with the same issue, or if you have a solution, please comment below. I appreciate your help!

@pingfan-hu pingfan-hu changed the title sliderTextInput compatibility problem on Quarto doc in the argument choices. sliderTextInput compatibility problem on Quarto doc in the argument choices. Apr 15, 2024
@etschste
Copy link

I encountered the same problem.

@pingfan-hu
Copy link
Author

pingfan-hu commented May 28, 2024

Yeah this is a relatively rare problem and will only occur when you want to use shiny as server on your qmd file. In usual cases people use the ShinyApp and it works out fine. Hopefully the shinyWidgets team could provide some guidance to us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants