I have created an action button as follows in my ui
div(style="display:inline-block",actionButton("action", label = "Help"))
I want this button to create a help box which the user can close which contains text on how to use this app. How do i do this?
Also, how do I customise this button? such as font, colour, alignment...
Thanks
Create an action button with actionButton() and an action link with actionLink() . Each of these functions takes two arguments: inputId - the ID of the button or link. label - the label to display in the button or link.
Shiny widgets enable you to create re-usable Shiny components that are included within an R Markdown document using a single function call. Shiny widgets can also be invoked directly from the console (useful during authoring) and show their output within the RStudio Viewer pane or an external web browser.
shinyApp. Finally, we use the shinyApp function to create a Shiny app object from the UI/server pair that we defined above. We save all of this code, the ui object, the server function, and the call to the shinyApp function, in an R script called app.
Clicking the action button increments a value, initially 0. You could use renderUI
in your server.R
file to define a widget that is empty when input$action is even, and helpText
when it is odd. That way, the same action button would both open and close the help.
output$HelpBox = renderUI({
if (input$action %% 2){
helpText("Here is some help for you")
} else {
return()
}
})
In ui.R
, use the uiOutput
function to display the widget. Remember that it will display nothing until the action button is clicked.
uiOutput("HelpBox")
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