Skip to content

Commit

Permalink
button width problem solved
Browse files Browse the repository at this point in the history
  • Loading branch information
pingfan-hu committed Sep 25, 2024
1 parent c18ceed commit 0d5529b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions R/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ sd_question <- function(
choices = list_name_md_to_html(option),
direction = direction,
selected = character(0),
width = width,
status = status
)

Expand All @@ -246,8 +245,7 @@ sd_question <- function(
choices = list_name_md_to_html(option),
direction = direction,
individual = individual,
justified = justified,
width = width
justified = justified
)

output <- shiny::tagAppendChild(output, shiny::tags$script(shiny::HTML(sprintf("
Expand Down Expand Up @@ -353,11 +351,15 @@ sd_question <- function(

}

# Check for the 2 types of buttons
is_button <- type %in% c("mc_buttons", "mc_multiple_buttons")

# Wrap the output in a div with custom data attributes
output_div <- shiny::tags$div(
id = paste0("container-", id),
`data-question-id` = id,
class = "question-container",
style = if (is_button) sprintf("width: %s;", width),
oninput = js_interaction,
output
)
Expand Down
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ This is a running list of things we're working on / have already added to the pr
- [x] Multiple choice (button...like formr mc_button)
- [x] Text area
- [x] Date
- [x] Slider
- [ ] Matrix
- [ ] Slider


Resources / other related examples:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ to the project:
- [x] Multiple choice (button…like formr mc_button)
- [x] Text area
- [x] Date
- [x] Slider
- [ ] Matrix
- [ ] Slider

Resources / other related examples:

Expand Down

0 comments on commit 0d5529b

Please sign in to comment.