Either u can use tags$button syntax directly or simply use the div function to create a button-like element. I replaced button(id = "action", "Get started") with div(id = "action", "Get started", class = "button"). This should work regardless of whether you are using Shiny or not.
card_function <- function(title, paragraph, tags) {
div(
class = "card",
div(class = "header"),
div(
class = "info",
p(class = "title", title),
p(paragraph)
),
div(
class = "footer",
p(class = "tag", tags),
div(id = "action", "Get started", class = "button")
)
)
}
# Example usage
card_function(title = 'Titulo', paragraph = 'paragrafo', tags = 'HTML')
using library as directed by @SamR, you can avoid the conflict with the tags object from the shiny package, either by changing the argument name from tags to tag_names, or by using shiny::tags$button as directed by @r2evans, Here I changed tags to tag_names.
library(shiny)
card_function <- function(title, paragraph, tag_names) {
div(
class = "card",
div(class = "header"),
div(
class = "info",
p(class = "title", title),
p(paragraph)
),
div(
class = "footer",
p(class = "tag", tag_names),
tags$button(id = "action", "Get started", class = "button")
)
)
}
# Example usage
card_function(title = 'Titulo', paragraph = 'paragrafo', tag_names = 'HTML')
tags = "HTML"
as an argument in your function. R does not seem to work out thattags$button(id = "action", "Get started")
refers toshiny::tags$button()
. Call the argumenttag_names
or something and it should be fine.shiny::tags$button
inside your function