I have a reactive checkboxGroupInput
taking as values the column names from a user-uploaded inputfile. The input file can sometimes have more than a hundred columns, so I have used this answer to align the choices into multiple columns. It works nicely most of the time, but sometimes the column names are very large, so the labels fall outside the box:
Any idea how can I overcome this issue?
I have prepared a sample code using mtcars
dataset (and row.names
instead of colnames
just for the sake of the example).
library(shiny)
library(shinydashboard)
sidebar <- dashboardSidebar(
sidebarMenu(
busyIndicator(text="Loading..."),
tags$head(
tags$style(
HTML('
.multicol {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
-moz-column-fill: auto;
-column-fill: auto;
}
')
)
),
menuItem("Plot result", tabName = "scatterplot", icon = icon("area-chart"))
)
)
body <- dashboardBody(
tabItems(
tabItem(tabName = "scatterplot",
box(
title="CHECKBOX",solidHeader = TRUE, status="primary",
tags$div(align = 'left',
class = 'multicol', uiOutput("covarselect")),
width=2
)
)
)
)
ui=dashboardPage(
dashboardHeader(title = "analysis"),
sidebar,
body
)
server <- function(input, output,session) {
output$covarselect <- renderUI({
mtcars <- datasets::mtcars
row.names(mtcars) <- gsub(" ","",row.names(mtcars))
checkboxGroupInput("carselect","Select any that apply",as.list(row.names(mtcars)),inline=F)
})
}
shinyApp(ui = ui, server = server)
EDIT
As per the suggestion of Nikhil Nanjappa I have tried reproducing the issue in a fiddle, although I did not succeed in reproducing the box
as in shinydashboard