Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To enable the use of position:sticky in shinydashboard, you can follow these steps:

  1. Add the following CSS code to your app.css file:
/* Enable position:sticky */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 1030;
}
  1. Apply the sticky-top class to the element you want to make sticky. For example, if you want to make the dashboard header sticky, you can add the class to the header tag:
dashboardHeader(title = "My App", class = "sticky-top")
  1. Make sure the element has a fixed height. This is important because position:sticky requires an explicit height to work correctly. You can set a fixed height using CSS or by setting the height argument in the shinydashboard element.
dashboardHeader(title = "My App", class = "sticky-top", height = 60)

By following these steps, you should be able to enable the use of position:sticky in your shinydashboard app.