shiny::textInput where value = NULL

I'm working on a Shiny app with input

shiny::textInput(
                  inputId = "plot_title",
                  label = tags$span("Create Custom Title for Plot(s)", style = "color:white;"),
                  value =  NULL
                )

I want to check if input$plot_title is NULL with the rlang null-coalescing operator %||%, but this doesn't seem to work.

Is the reason that in Shiny, textInput() with value = NULL doesn't actually create a NULL value - it creates an empty string ("")?

Yes, the return value is "" when the text field is empty.

1 Like