Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: Dashboard Header Cut Off When Sidebar Collapsed #115

Open
b-tomhave opened this issue Mar 9, 2021 · 2 comments
Open

Issue: Dashboard Header Cut Off When Sidebar Collapsed #115

b-tomhave opened this issue Mar 9, 2021 · 2 comments

Comments

@b-tomhave
Copy link

b-tomhave commented Mar 9, 2021

Hello,
Thank you for your work updating this package. I am currently running across two issues.

(1): Dashboard header titles are cut-off when the sidebar is collapsed (did not happen in the old version).

(2): The sidebar cannot be completely disabled nor completely collapsed. Instead a thin grey column remains.

In brief, is it possible to show the entire header title even when the sidebar is collapsed and is it possible to either entirely disable the sidebar and to entirely collapse the sidebar?

Below I have attached some sample code and a few screenshots.

Unwanted Shortened Title and Not Fully Collapsed/Hidden Sidebar
ShortenedTitle

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- dashboardPage(
    title = "Box API",
    dashboardHeader(title= "A very very very very long title", titleWidth = 500),
    dashboardSidebar(width = 500),
    dashboardBody(
        tags$style("body { background-color: ghostwhite}"),
        fluidRow(
            actionButton("toggle_box", "Toggle Box"),
            actionButton("remove_box", "Remove Box", class = "bg-danger"),
            actionButton("restore_box", "Restore Box", class = "bg-success"),
            actionButton("update_box", "Update Box", class = "bg-primary")
        ),
        br(),
        box(
            title = textOutput("box_state"),
            "Box body",
            id = "mybox",
            collapsible = TRUE,
            closable = TRUE,
            plotOutput("plot")
        )
    )
)

server <- function(input, output, session) {
    output$plot <- renderPlot({
        req(!input$mybox$collapsed)
        plot(rnorm(200))
    })
    
    output$box_state <- renderText({
        state <- if (input$mybox$collapsed) "collapsed" else "uncollapsed"
        paste("My box is", state)
    })
    
    observeEvent(input$toggle_box, {
        updateBox("mybox", action = "toggle")
    })
    
    observeEvent(input$remove_box, {
        updateBox("mybox", action = "remove")
    })
    
    observeEvent(input$restore_box, {
        updateBox("mybox", action = "restore")
    })
    
    observeEvent(input$update_box, {
        updateBox(
            "mybox", 
            action = "update", 
            options = list(
                title = h2("New title", dashboardLabel(1, status = "primary")),
                status = "danger", 
                solidHeader = TRUE,
                width = 4
            )
        )
    })
    
    observeEvent(input$mybox$visible, {
        collapsed <- if (input$mybox$collapsed) "collapsed" else "uncollapsed"
        visible <- if (input$mybox$visible) "visible" else "hidden"
        message <- paste("My box is", collapsed, "and", visible)
        showNotification(message, type = "warning", duration = 1)
    })
}

shinyApp(ui, server)
@DivadNojnarg
Copy link
Member

For the sidebar, there is a parameter called minified. If you set it to FALSE, the sidebar will have the default {shinydashboard} behavior.

@b-tomhave
Copy link
Author

For the sidebar, there is a parameter called minified. If you set it to FALSE, the sidebar will have the default {shinydashboard} behavior.

Thank you! This worked perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants