Reputation: 22280
How can I show the text of the first two rows in a renderTable in bold? Can I do this without DT/renderDataTable?
Upvotes: 1
Views: 2569
Reputation: 893
Try this:
library(shiny)
ui <- fluidPage(
tags$head(
tags$style(
"tr:nth-child(1) {font-weight: bold;}
tr:nth-child(2) {font-weight: bold;}
"
)
),
tableOutput("tbl")
)
server <- function(input, output){
output$tbl <- renderTable({iris})
}
shinyApp(ui, server)
Upvotes: 1
Reputation: 17729
How about this:
shinyApp(
ui = fluidPage(
tags$head(
tags$style(
HTML("tr:first-child, tr:first-child + tr { font-weight: bold }")
)
),
fluidRow(
column(12, tableOutput('table')
)
)
),
server = function(input, output) {
output$table <- renderTable(head(iris))
}
)
Upvotes: 3