Comments (10)
Current hack by Tobi Guennel for a project we're working on.
# create a new dashboardHeader function with the ability to pass in a title
dashboardHeader <- function(..., title = NULL, disable = FALSE,title.navbar=NULL, .list = NULL) {
items <- c(list(...), .list)
#lapply(items, tagAssert, type = "li", class = "dropdown")
tags$header(class = "main-header",
style = if (disable) "display: none;",
span(class = "logo", title),
tags$nav(class = "navbar navbar-static-top", role = "navigation",
# Embed hidden icon so that we get the font-awesome dependency
span(shiny::icon("bars"), style = "display:none;"),
# Sidebar toggle button
a(href="#", class="sidebar-toggle", `data-toggle`="offcanvas",
role="button",
span(class="sr-only", "Toggle navigation")
),title.navbar,
div(class = "navbar-custom-menu",
tags$ul(class = "nav navbar-nav",
items
)
)
)
)
}
title.navbar.html <- tags$div(style="color:white;text-align:left;vertical-align:middle;display:inline-block;font-size: 30px;font-size: 1.5vw;padding-left: 5px",
HTML(paste0("TITLE HERE")))
header <- dashboardHeader(
title = img(src="PATH_logo_white.png", height = 45),
title.navbar = title.navbar.html
)
)
from shinydashboard.
This hack doesn't work very well when the screen width get's smaller. The text will shrink to fit in the space, and not actually create a new line.
May not be a problem for shorter titles, but can be an issue for larger ones.
from shinydashboard.
+1 for any progress on this.
I would also like an elegant as possible option to have say email and twitter icons with relevant url links where the messageItems currently reside
from shinydashboard.
I added an example for this in the docs:
http://rstudio.github.io/shinydashboard/appearance.html#long-titles
It's not as simple as an option to the R functions, but I think that using custom CSS is the least bad way to do it here.
from shinydashboard.
I've changed my mind and added a titleWidth
option, so you don't need to use custom CSS. The docs have been updated to reflect this.
from shinydashboard.
looks good @wch!
I'm assuming you are still able to add an image as well by using img
tags?
from shinydashboard.
Yup, that should work.
I've just realized that adding width control in the way that I did may cause problems on mobile devices, so it might take more time to get a proper fix in there.
from shinydashboard.
That seems like it can be fixed with CSS media queries. But I'm not sure how the dashboardHeader
handles line breaks IIRC, it doesn't like things that are taller than the current height
from shinydashboard.
Unfortunately, the standard title/sidebar width of 230px
is coded into the AdminLTE CSS. Making width
an option with proper behavior in various screen widths would probably require manually overriding all of those instances in the CSS. :(
from shinydashboard.
OK, I think I have it straightened out, so there should be no trouble on mobile devices. I also implemented a sidebar width option.
from shinydashboard.
Related Issues (20)
- can not see my second tabitem after clicking action button HOT 1
- Error with publication of a Shiny App with R
- [Update request] The default icon for menuSubItem() "angle-double-right" is now "angles-right" in Font Awesome 6.0.0 HOT 5
- dynamic footer HOT 6
- FYI copyright on the shinydashboard website HOT 1
- dashboardPage shouldn't create <title> HTML tags if title = NULL HOT 1
- dashboardBody not showing when conditionalPanel is used HOT 1
- Toggling boxes to collapse has unexpected results with nested boxes HOT 1
- ShinyDash fails to render since R4.3 added to computer. HOT 3
- `shinydashboard::updateTabItems` not matching `shiny::updateTabsetPanel` HOT 2
- Why use unsecure AdminLTE? HOT 4
- Remove/hide footer from dashboard HOT 3
- Collapsible box not responding in my navbarPage Rshiny
- shinydashboard - "Get started" Tab [1 Link + 1 Typo] HOT 1
- shinydashboard - "Appearance" Tab [1 Punctuation]
- shinydashboard - "Behavior" Tab [1 Typo]
- I am using the R Package shinydashboard, now the dashboardSidebar is NOT showing in black background HOT 8
- `updateTabItems` not working when selecting dynamically rendered `menuSubItem` HOT 2
- sidebar id is not in input inside a RMarkdown HOT 3
- Mention this package is not meant to be used in conjunction with {bslib}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shinydashboard.