Customizing uiOutput wrapper in R Shiny

Whenever I utilize renderUI on the server side and uiOutput on the UI side, the HTML is always wrapped within a div. Is there a way to wrap it in a span instead?

For instance:

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 to span)

Thank you for the assistance

Answer №1

When you use the argument inline=T, it will generate a span element instead of a div:

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

This means that:

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Instructions for positioning two 3D models within separate div elements using Three.js

The website contains various divs with classes such as "skin", "skin2", "skin3"... And each class corresponds to a different 3d model that needs to be placed. I am attempting to achieve this, but all the 3d models seem to be c ...

Aurelia validator fails to refresh user interface

Despite the aurelia-validator plugin working correctly for form submission and validation, with all properties updating properly, the UI does not reflect any changes. There is no red outline around incorrect properties or error messages displayed. I have r ...

Matching reserved characters in R using regular expressions

Looking to extract a specific part from each line in my data frame that follows a certain pattern. x= RPA4|RP1-117P191 I am aiming to extract: RPA4 Specifically, I want everything after the pipe character to be removed. My attempt using gsub to only c ...

How to Customize Bootstrap Colors Globally in Angular 4 Using Code

I am interested in developing a dynamic coloring system using Angular. I have set up a service with four predefined strings: success, info, warning, and danger, each assigned default color codes. My goal is to inject this service at the root of my applicat ...

Using the MVC framework, create a hyperlink with custom CSS styling by

Having trouble getting a specific class to override the default styles for a:link @Html.ActionLink("Back to List", "Index", null, new { @class = "htmlactionlink" }) CSS a:link, a:visited, a:active, a:hover { color: #333; } .htmlactionlink { co ...

Assign the chosen option value to a PHP variable for storage

Is there a way to assign the selected value of a select input to a php variable? I'm trying to take the value that is selected in a select box and store it in a php variable, then echo out the selected option value. However, I am having trouble access ...

Sturdy and adaptable in a container designed with a responsive width

Currently, I am developing a responsive app and I am facing the challenge of making some parts of the search bar responsive while keeping others fixed in width (like the search icon). I attempted to achieve this using the following code: .wrapper{ ...

Icon Vanishes When Drop-down is Chosen (and the label value is loaded dynamically)

I am facing an issue with adding an icon to a text value in HTML. The problem arises when the icon is added to a Bootstrap button. Upon selecting a value from an external source, the button label changes accordingly. However, this change in text causes the ...

Adjust the background color of the arrow in an HTML Select element

My select menu looks different in Firefox compared to Chrome/Edge In Firefox, it displays an "arrow button" https://i.stack.imgur.com/BGFvO.png However, in Chrome/Edge, the arrow button is not present https://i.stack.imgur.com/PXNJn.png Is there a way ...

Is there a way to trigger both the link and the div element simultaneously?

Is there a way to make both the button and the link light up simultaneously when hovering over the div element, instead of just the button lighting up first? <div id="b1"; class = b> <a href="test.html">BUY</a> < ...

What causes my form submission to redirect to a php file instead of staying on the

I'm currently using PHP mailer to send emails with data. The form submission is working perfectly on XAMPP locally, as I receive the email with the specified data after submitting the form. However, when I try running my app on Vercel or Netlify, it ...

Determine the number of rows in each group until a specific condition is met

I am currently working on determining the number of rows until a specific condition is met within a grouped data frame. I have tried to modify the solution here but it seems to not work well with groups. Here is some example data: grp <- c(rep(1:2, ea ...

Using canvas transformation changes the way drawImage is applied

I have been working on a game as a hobby and you can find it at . I have managed to get most aspects of the game working well, such as transformation, selection, movement, and objects. However, there is one particular challenge that I am struggling with. ...

What methods can be utilized to ensure that my wistia video player/playlist is responsive on different devices

I need some assistance with making my Wistia player responsive while using a playlist. I want the video player to adjust its size based on the screen size. Here is an example: My current code utilizes their iframe implementation: <div id="wistia_1n649 ...

Basic HTML user interface elements

I'm struggling with some basic HTML/CSS and I'm looking for guidance on what I might be doing incorrectly or if there is a more efficient approach? I'm attempting to create a simple user interface, and while I have put this together, it doe ...

Automating the process of disabling a function on Internet Explorer

As I work on a new Internet Explorer plug-in, I've come across a frustrating feature that has been present since at least IE7. This feature allows users to modify the sizing of HTML elements in editable windows, like rich text emails in GMail, by simp ...

Using the "align" attribute is considered outdated and not recommended in HTML5 documents

I have encountered an error when using the align attribute. How can I fix this issue with the correct HTML5 compatible syntax? <table style="margin: 0 auto;"> <tbody> <tr> <td><input typ ...

Tips for utilizing gsub to substitute one data point with a different one?

Within my data frame, there is a column that contains salutations or titles. Upon generating a summary of the column, the output appears as follows: DR. DR MS. Ms. MS -------------------- 6 20 31 12 21 My intention was to combine DR. as DR and MS. ...

Accessing a JavaScript function from a file stored on the SD card using Android Studio

I'm currently developing an Android application that writes an HTML file to the SD card and then loads it in a web view. The app is able to load the HTML file, but the JavaScript functions within the file are not functioning correctly. Here is the cod ...

When I set the margin to 0 for both the div and body elements, the divs still have margins

Attempting to place a canvas inside a div named touch-container, with 3 additional divs on top and sizing them using javascript. The issue arises as each of the 3 divs appear to have a margin that fills up the remaining space in the container, despite spe ...