One kind of bootstrap3 input group: a textinput and a button attached to the end
textButton(
textId,
btnId = paste0(textId, "_btn"),
label = "",
text_value = "",
placeholder = "",
tooltip = "",
placement = "bottom",
btn_icon = NULL,
btn_label = "btn",
style = "",
...
)
the text input ID
the button ID, if not specified, it is "textId" + "_btn" like, textId_btn
label of the whole group, on the top
initial value of the text input
placeholder text of the text input
a tooltip of the group
where should the tooltip go?
a shiny::icon of the button
text on the button
additional CSS style of the group
additional args pass to the button, see shiny::actionButton
a shiny input group
if(interactive()){
library(shiny)
ui <- fluidPage(
column(
6,
textButton(textId = "tbtn_default", label = "default"),
textButton(
textId = "tbtn-icon",
label = "change icon and color",
btn_icon = icon("house"),
class = "btn-warning" # pass to the button
),
textButton(
textId = "tbtn_style",
label = "change styles",
style = "color: red; border: 2px dashed green;"
),
textButton(
textId = "tbtn_submit",
label = "interact with shiny server",
btn_label = "Submit",
placeholder = "type and submit",
class = "btn-primary"),
verbatimTextOutput("tbtn_submit_out")
)
)
server <- function(input, output, session) {
# watch for the button ID "tbtn_submit" + "_btn"
observeEvent(input$tbtn_submit_btn, {
output$tbtn_submit_out <- renderPrint(isolate(input$tbtn_submit))
})
}
shinyApp(ui, server)
}