From 0d5529be949b8eee7618f7d4aedf3ad000ff23d2 Mon Sep 17 00:00:00 2001 From: Pingfan Hu Date: Tue, 24 Sep 2024 23:08:30 -0400 Subject: [PATCH] button width problem solved --- R/ui.R | 8 +++++--- README.Rmd | 3 ++- README.md | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/R/ui.R b/R/ui.R index 045825ff..28ea7a39 100644 --- a/R/ui.R +++ b/R/ui.R @@ -228,7 +228,6 @@ sd_question <- function( choices = list_name_md_to_html(option), direction = direction, selected = character(0), - width = width, status = status ) @@ -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(" @@ -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 ) diff --git a/README.Rmd b/README.Rmd index c13daf74..5783d9ec 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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: diff --git a/README.md b/README.md index 4183dde8..195106ae 100644 --- a/README.md +++ b/README.md @@ -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: