Skip to content

Commit

Permalink
Update 158-input-labels to leverage HTML labels
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Mar 15, 2024
1 parent 71f027e commit 276c891
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inst/apps/158-input-labels/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ row <- function(w1, w2) {
fluidRow(column2(w1), column2(w2))
}

label_initial <- "An <i>escaped</i> Label"
label_initial <- HTML("An <i>escaped</i> Label")

ui <- fluidPage(
p("Everytime you click on the button below, it should add labels to the column that doesn't (currently) have labels, and remove labels from the column that does (currently) have labels. Every label should say: '", tags$b(label_initial, .noWS = "outside"), "'."),
Expand Down Expand Up @@ -135,7 +135,7 @@ server <- function(input, output, session) {
shinyjster::shinyjster_server(input, output, session)

observeEvent(input$update, {
label1 <- if (isTRUE(input$update %% 2 == 0)) character(0) else "An <i>escaped</i> Label"
label1 <- if (isTRUE(input$update %% 2 == 0)) character(0) else HTML("An <i>escaped</i> Label")
updateTextInput(session, "textInput1", label = label1)
updateTextAreaInput(session, "textAreaInput1", label = label1)
updateNumericInput(session, "numericInput1", label = label1)
Expand All @@ -149,7 +149,7 @@ server <- function(input, output, session) {
updateCheckboxGroupInput(session, "checkboxGroupInput1", label = label1)
updateDateInput(session, "dateInput1", label = label1)

label2 <- if (isTRUE(input$update %% 2 > 0)) character(0) else "An <i>escaped</i> Label"
label2 <- if (isTRUE(input$update %% 2 > 0)) character(0) else HTML("An <i>escaped</i> Label")
updateTextInput(session, "textInput2", label = label2)
updateTextAreaInput(session, "textAreaInput2", label = label2)
updateNumericInput(session, "numericInput2", label = label2)
Expand Down

0 comments on commit 276c891

Please sign in to comment.