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

Make the controllbar icon changeable #384

Open
kleinerChemiker opened this issue Dec 5, 2024 · 1 comment
Open

Make the controllbar icon changeable #384

kleinerChemiker opened this issue Dec 5, 2024 · 1 comment

Comments

@kleinerChemiker
Copy link

It would be great if the controllbar icon could be changed. E.g. add an "icon =" argument to dashboardControlbar()

@fernandoroa
Copy link

+1
for now we can do:

library(shiny)
library(bs4Dash)

shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    controlbar = dashboardControlbar(
      overlay = TRUE,
      "Control bar content"
    ),
    footer = dashboardFooter(),
    body = dashboardBody(
      tags$h2("Main Content"),
      tags$script(HTML("
        document.addEventListener('DOMContentLoaded', function() {

          const controlbarToggle = document.getElementById('controlbar-toggle');

          if (controlbarToggle) {
            const icon = controlbarToggle.querySelector('i');
            if (icon) {
              icon.className = 'fas fa-cog'; 
              icon.setAttribute('aria-label', 'cog icon');
            }
          }
        });
      "))
    )
  ),
  server = function(input, output) {}
)

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