woshitom
woshitom

Reputation: 5131

R Shiny: Change uiOutput wrapper

Every time I use renderUI (server side) and uiOutput (UI side) the html is wrapper by a div, how can I wrappe it by a span instead?

For example:

UI side:

tags$p(uiOutput("my_variable"))

Server side:

output$currentLev1 <- renderUI({return(input$my_variable)})

Result:

<div id="my_variable" class="shiny-html-output shiny-bound-output">my_variable</div>

Desired result:

<span id="my_variable" class="shiny-html-output shiny-bound-output">my_variable</span>

(simply change div by span)

Thanks for the help

Upvotes: 0

Views: 1126

Answers (1)

shosaco
shosaco

Reputation: 6165

Using argument inline=T creates a span instead of a div:

> args(uiOutput)
function (outputId, inline = FALSE, container = if (inline) span else div, 
    ...) 
NULL

and so:

> uiOutput("test", inline=T)
<span id="test" class="shiny-html-output"></span>

Upvotes: 1

Related Questions