Skip to content

htmltools::tag() and varArgs not documented #431

@JosiahParry

Description

@JosiahParry

I am trying to understand how to create a custom tag for a component library. However the tag() function does not have an example. It is unclear what the structure of varArgs argument should be.

htmltools/R/tags.R

Lines 639 to 667 in 038ef7b

#' tags$html(
#' tags$head(
#' tags$title('My first page')
#' ),
#' tags$body(
#' h1('My first heading'),
#' p('My first paragraph, with some ', strong('bold'), ' text.'),
#' div(
#' id = 'myDiv', class = 'simpleDiv',
#' 'Here is a div with some attributes.'
#' )
#' )
#' )
#'
#' # html5 <audio> with boolean control attribute
#' # https://www.w3.org/TR/html5/infrastructure.html#sec-boolean-attributes
#' tags$audio(
#' controls = NA,
#' tags$source(
#' src = "myfile.wav",
#' type = "audio/wav"
#' )
#' )
#'
#' # suppress the whitespace between tags
#' tags$span(
#' tags$strong("I'm strong", .noWS="outside")
#' )
#'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions