Password Field

#| standalone: true
#| components: [viewer]
#| viewerHeight: 200

library(shiny)
library(bslib)

ui <- page_fixed(
  passwordInput(
    "password",
    "Password",
    value = "mypassword1"
  ), 
  verbatimTextOutput("value")
)

server <- function(input, output) {
  output$value <- renderText({ input$password })
}

shinyApp(ui, server)
library(shiny)
library(bslib)

ui <- page_fixed(
  passwordInput( 
    "password", 
    "Password", 
    value = "mypassword1" 
  ), 
  verbatimTextOutput("value")
)

server <- function(input, output) {
  output$value <- renderText({ input$password })
}

shinyApp(ui, server)
No matching items

Relevant Functions

  • passwordInput
    passwordInput(inputId, label, value = "", width = NULL, placeholder = NULL)

No matching items

Details

A password field creates a text box for password entry.

To add a password field to your app:

  1. Add passwordInput() to the UI of your app to create a password field. Where you call this function will determine where the password field will appear within the app’s layout.

  2. Specify the inputId and label arguments of passwordInput() to define the identifier and label of the passsword field. Optionally, specify the value argument to set the initial value of the password field.

The value of an input component is accessible as a reactive value within the server() function. To access the value of a password field:

  1. Use input$<password_field_id> (e.g., input$password) to access the value of the password field. The server value of a password field is a string.