R ShinyDashboard textOutput to Header
You will have to paste the content as HTML
inside tags$a
, as shown below. You will also have to renderText
twice, as the same value cannot be used in the UI.
library (shiny)
library (shinydashboard)
rm(list=ls())
header <- dashboardHeader(
title = "TEST",
tags$li(class = "dropdown", tags$a(HTML(paste("Refreshed on ", textOutput("Refresh1"))))))
body <- dashboardBody(
fluidRow(box(textOutput("Refresh2")))
)
sidebar <- dashboardSidebar()
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output) {
output$Refresh1 <- renderText({
toString(as.Date("2017-5-4"))
})
output$Refresh2 <- renderText({
toString(as.Date("2017-5-4"))
})
}
shinyApp(ui, server)
How to align the text on the right side of the value box in R shiny?
If you want to have different styling on elements the best thing to do is to split them up in different tags.
In this case I would suggest span
since it is an inline tag. there are many different ways how o align on object with html and css. I believe the easiest is just to add float:right
to the second span tag.
output$header <- shinydashboard::renderValueBox({
shinydashboard::valueBox(tags$p(tags$span("Hello"),tags$span("World!", style = "float:right"), style ="color : black"), "Hi!")
})
Related Topics
Configuration Failed Because Libcurl Was Not Found
Stop Lapply from Printing to Console
Find Locations Within Certain Lat/Lon Distance in R
Time Series Plot with X Axis in "Year"-"Month" in R
R: Calculate Cosine Distance from a Term-Document Matrix with Tm and Proxy
Convert Quarter/Year Format to a Date
Reduce File Size of R Markdown HTML Output
Two Y-Axes with Different Scales for Two Datasets in Ggplot2
Problems Formatting Date into Format "%Y-%M"
How to Split an Igraph into Connected Subgraphs
"Adding Missing Grouping Variables" Message in Dplyr in R
What Are the Differences Between Concatenating Strings with Cat() and Paste()
Add Regression Plane to 3D Scatter Plot in Plotly
Got Message Unable to Load Shared Object Stats.So When R Starts
Existing Function for Seeing If a Row Exists in a Data Frame