Open michaeltirtana opened 3 years ago
A workaround with {htmltools}
:
library(shiny)
library(bs4Dash)
library(shinyWidgets)
library(shinyjs)
header <- dashboardHeader(compact = TRUE)
header[[1]] <- tagAppendAttributes(header[[1]], id = "header")
body <- dashboardBody(
useShinyjs(),
loginpage,
setBackgroundImage(
src = "https://www.fillmurray.com/1920/1080",
shinydashboard = TRUE
)
)
body$attribs$class <- paste(body$attribs$class, "login-page")
loginpage <- div(
id = "loginpage",
bs4Card(
width = 12, collapsible = FALSE, headerBorder = FALSE,
textInput("userName", placeholder="Username", label = tagList(icon("user"), "Username")),
passwordInput("passwd", placeholder="Password", label = tagList(icon("unlock-alt"), "Password")),
br(),
div(
style = "text-align: center;",
actionButton("login", "SIGN IN", width = '100%', style = "color: white; background-color:#000000;"),
shinyjs::hidden(
div(id = "nomatch", tags$p("Oops! Incorrect username or password!",
style = "color: red; font-weight: 600; padding-top: 5px;font-size:16px;",
class = "text-center"))),
br(),
)
)
)
ui <- dashboardPage(
header,
dashboardSidebar(disable = TRUE),
body
)
server = function(input, output, session) {
shinyjs::hide(id = "header", anim = FALSE)
}
# Run the application
shinyApp(ui = ui, server = server)
A very late reply, but maybe someone will find this useful - there is no need for {shinyjs}
. All you have to do, is to set:
header <- list(shiny::tags$nav(style = "display: none;", class = "main-header navbar navbar-expand"), NULL)
Please note that this solution does not work with sidebar enabled.
@domsle - your solution worked for me. I also had no problem with the sidebar being enabled either. Anyone else who wants to use @domsle 's solution: where he has a NULL
as the 2nd argument in his list you can replace that with bs4Dash::dashboardBrand
if you want to still keep the branding at the top of the sidebar.
I am trying to disable the header component the dashboard. The code below is my attempt in doing so, using the arg disable=TRUE. However, this code fails as the header still shows.