textInputIcon | R Documentation |
Extend form controls by adding text or icons before,
after, or on both sides of a classic textInput
.
textInputIcon(
inputId,
label,
value = "",
placeholder = NULL,
icon = NULL,
size = NULL,
width = NULL
)
inputId |
The |
label |
Display label for the control, or |
value |
Initial value. |
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. |
icon |
An |
size |
Size of the input, default to |
width |
The width of the input, e.g. |
A text input control that can be added to a UI definition.
See updateTextInputIcon()
to update server-side, and numericInputIcon()
for using numeric value.
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
# Test with different version of Bootstrap
theme = bslib::bs_theme(version = 5),
tags$h2("textInputIcon examples"),
fluidRow(
column(
width = 6,
textInputIcon(
inputId = "ex1",
label = "With an icon",
icon = icon("circle-user")
),
verbatimTextOutput("res1"),
textInputIcon(
inputId = "ex2",
label = "With an icon (right)",
icon = list(NULL, icon("circle-user"))
),
verbatimTextOutput("res2"),
textInputIcon(
inputId = "ex3",
label = "With text",
icon = list("https://")
),
verbatimTextOutput("res3"),
textInputIcon(
inputId = "ex4",
label = "Both side",
icon = list(icon("envelope"), "@mail.com")
),
verbatimTextOutput("res4"),
textInputIcon(
inputId = "ex5",
label = "Sizing",
icon = list(icon("envelope"), "@mail.com"),
size = "lg"
),
verbatimTextOutput("res5")
)
)
)
server <- function(input, output, session) {
output$res1 <- renderPrint(input$ex1)
output$res2 <- renderPrint(input$ex2)
output$res3 <- renderPrint(input$ex3)
output$res4 <- renderPrint(input$ex4)
output$res5 <- renderPrint(input$ex5)
}
if (interactive())
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.