Description Usage Arguments Details Value See Also Examples
This is a series of textInputs with a functionality for validating the provided text inputs.
1 2 | TextInputUI(id, labels, value = NULL, dummy = "Insert text here",
help = "Some message about input.", horiz = FALSE)
|
id |
chr id of this object for shiny session |
labels |
chr arr for textInput labels. length defines how many input fields there are |
value |
chr arr of length 1 or length(labels) defining default string inside all or each input fields. NULL for no default value text. This is an actual input if it is not changed. |
dummy |
chr arr of length 1 or length(labels) defining dummy text inside all or each input fields. NULL for no dummy text. This appears inside text field but is not an actual input. |
help |
chr or NULL (NULL) for help text placed underneath input fields. |
horiz |
bool (FALSE) whether ui elements should be placed horizontally, not vertically |
The length of labels argument defines how many input fields there are. So, argument n of the TextInput (server) function must be equal to length(labels).
chr HTML for creating ui elements.
Other TextInput module functions: TextInput
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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("TextInputUI"),
TextInputUI("id1", c("positive Ctrls", "non-targeting Ctrls"), c("positive", "non-targeting"),
help = "use HGNC symbols", horiz = FALSE)
),
mainPanel(h2("Output of TextInput"), verbatimTextOutput("display"))
))
server <-function(input, output, session) {
display <- callModule(TextInput, "id1", n = 2, 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.