Description Usage Arguments Value See Also Examples
View source: R/ReactiveTextInput.R
This is a reactive series of text input fields with a functionality for validating the provided text inputs. The number of text input fields in reactive.
1 | ReactiveTextInputUI(id, title)
|
id |
chr id of this object for shiny session |
title |
chr or NULL for h3 title above text input fields |
chr HTML for creating ui elements.
Other ReactiveTextInput module functions: ReactiveTextInput
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | library(shinyTools)
# some function as example
check <- function(text, add){ if(any(grepl(add$pat, text))) return(paste("Don't use letter", add$pat, "in any entry."))}
# little app with module
ui <- fluidPage(sidebarLayout(
sidebarPanel(h2("ReactiveTextInputUI"),
numericInput("nGroups", "n Groups", 2, -2, 10),
ReactiveTextInputUI("id1", "Groups")
),
mainPanel(h2("Output of ReactiveTextInput"), verbatimTextOutput("display"))
))
server <-function(input, output, session) {
display <- callModule(ReactiveTextInput, "id1", n = reactive(input$nGroups), prefix = "Group",
values = c("Untreated", "Treated"), checkFun = "check", addArgs = list(pat = "X"))
output$display <- renderPrint(display())
}
shinyApp(ui, server)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.