I am trying to display messages like "user is authenticated" or "account created" in Shiny with uiOutput
, but it overrides the front page of my Shiny dashboard which is not required.
Is there a function in Shiny in which we can add a message box like thing, which can be closed once the message is displayed and then the user can proceed?
Simply call shinyalert() with the desired arguments, such as a title and text, and a modal will show up. In order to be able to call shinyalert() in a Shiny app, you must first call useShinyalert() anywhere in the app's UI.
You can use tahs$h1() to h6() to add headings, or add text using textOutput(). You can add text using text within quotes(" ").
Along with Shiny elements, you can use HTML elements to stylize your content in your application. In my opinion, R Shiny is very easy to learn despite how powerful the tool is. If you're working on a side project or looking to add something to your portfolio, I highly recommend trying it out.
Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.
You could use modalDialogs
for that, here is a working example:
library(shiny)
ui = fluidPage(
actionButton("login", "Log in"),
textInput('userid','User id:',value=' definitely not Florian')
)
server = function(input, output) {
observeEvent(input$login, {
showModal(modalDialog(
title = "You have logged in.",
paste0("It seems you have logged in as",input$userid,'.'),
easyClose = TRUE,
footer = NULL
))
})
}
shinyApp(ui,server)
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With