I use textInput in my shinyapp. When the user write I want to see - "****" - like password field, but I don't want to use passwordInput, How can I do it with using only textInput ?
if (interactive()) {
ui <- fluidPage(
textInput("caption", "Caption", "Data Summary"),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderText({ input$caption })
}
shinyApp(ui, server)
}
CodePudding user response:
You could define a custom function:
textInputStars <- function(inputId, label, value = "", width = NULL,
placeholder = NULL) {
value <- restoreInput(id = inputId, default = value)
div(class = "form-group shiny-input-container",
style = css(width = validateCssUnit(width)),
shinyInputLabel(inputId, label),
tags$input(id = inputId, type="password", , value=value,
placeholder = placeholder)
)
}
First answer:
Use passwordInput()