Skip to contents

f7Text creates a text input container.

updateF7Text changes the value of a text input on the client.

Usage

f7Text(inputId, label, value = "", placeholder = NULL)

updateF7Text(
  inputId,
  label = NULL,
  value = NULL,
  placeholder = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

inputId

The id of the input object.

label

The label to set for the input object.

value

The value to set for the input object.

placeholder

The placeholder to set for the input object.

session

The Shiny session object, usually the default value will suffice.

Examples

# A text input
if(interactive()){
 library(shiny)
 library(shinyMobile)

 shinyApp(
   ui = f7Page(
     title = "My app",
     f7SingleLayout(
      navbar = f7Navbar(title = "f7Text"),
      f7Text(
       inputId = "caption",
       label = "Caption",
       value = "Data Summary",
       placeholder = "Your text here"
      ),
      verbatimTextOutput("value")
     )
   ),
   server = function(input, output) {
     output$value <- renderPrint({ input$caption })
   }
 )
}
# Update text input
if (interactive()) {
 library(shiny)
 library(shinyMobile)

 ui <- f7Page(
   f7SingleLayout(
    navbar = f7Navbar(title = "updateF7Text"),
    f7Block(f7Button("trigger", "Click me")),
    f7Text(
     inputId = "text",
     label = "Caption",
     value = "Some text",
     placeholder = "Your text here"
    ),
    verbatimTextOutput("value")
   )
 )

 server <- function(input, output, session) {
   output$value <- renderPrint(input$text)
   observeEvent(input$trigger, {
     updateF7Text("text", value = "Updated Text")
   })
 }
shinyApp(ui, server)
}