tags | R Documentation |
Create an HTML tag to place in a Dash app layout. All tags are available
in the html
list, and some common tags have shortcuts as functions for
convenience (e.g. h1()
produces <h1>
and is equivalent to html$h1()
).
html
h1(...)
h2(...)
h3(...)
h4(...)
div(...)
span(...)
p(...)
strong(...)
br(...)
button(...)
a(...)
img(...)
dash_tag(tag_name, content = list())
... |
Any named arguments become tag attributes, and any unnamed
arguments become children. A named argument with a value of |
tag_name |
The name of the HTML tag. |
content |
List of attributes and children. |
There are a few HTML attributes that are treated in a special way:
To add a class
attribute, use the className
parameter
To add a for
attribute, use the htmlFor
parameter
The style
attribute is not provided as a string. Instead, it's provided
as a named list, where the name and value of each element correspond to the
CSS property and value. Each CSS property should be written in camelCase.
A special property n_clicks
is automatically added to every HTML tag.
This property represents the number of times that this element has been
clicked on. If not explicitly initialized to a certain integer, its default
value is NULL
initially.
if (interactive()) {
app <- dash_app()
app %>% set_layout(
html$div(
h1(
"title",
style = list(
"color" = "red",
"backgroundColor" = "blue"
)
),
"some text",
button(
"can't click me",
disabled = NA,
className = "mybtn"
)
)
)
app %>% run_app()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.