add placeholder option to passwordInput()

This commit is contained in:
Dean Attali
2016-04-02 18:44:10 -07:00
parent 8a721fbd25
commit 4e5e0fb0ce
3 changed files with 12 additions and 3 deletions

2
NEWS
View File

@@ -47,6 +47,8 @@ shiny 0.13.2.9001
* navbarMenu now has dividers and dropdown headers (#888)
* Added `placeholder` option to `passwordInput`.
shiny 0.13.2
--------------------------------------------------------------------------------

View File

@@ -11,10 +11,12 @@
#' @examples
#' passwordInput("password", "Password:")
#' @export
passwordInput <- function(inputId, label, value = "", width = NULL) {
passwordInput <- function(inputId, label, value = "", width = NULL,
placeholder = NULL) {
div(class = "form-group shiny-input-container",
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
label %AND% tags$label(label, `for` = inputId),
tags$input(id = inputId, type="password", class="form-control", value=value)
tags$input(id = inputId, type="password", class="form-control", value=value,
placeholder = placeholder)
)
}

View File

@@ -4,7 +4,8 @@
\alias{passwordInput}
\title{Create a password input control}
\usage{
passwordInput(inputId, label, value = "", width = NULL)
passwordInput(inputId, label, value = "", width = NULL,
placeholder = NULL)
}
\arguments{
\item{inputId}{The \code{input} slot that will be used to access the value.}
@@ -15,6 +16,10 @@ passwordInput(inputId, label, value = "", width = NULL)
\item{width}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'};
see \code{\link{validateCssUnit}}.}
\item{placeholder}{A character string giving the user a hint as to what can
be entered into the control. Internet Explorer 8 and 9 do not support this
option.}
}
\value{
A text input control that can be added to a UI definition.