Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow {bsicons} for icon argument to nav_panel #639

Closed
chrisbrownlie opened this issue Jun 19, 2023 · 1 comment · Fixed by #645
Closed

Allow {bsicons} for icon argument to nav_panel #639

chrisbrownlie opened this issue Jun 19, 2023 · 1 comment · Fixed by #645

Comments

@chrisbrownlie
Copy link

In a {shiny} app I'm working on, we're trying to stick to using Bootstrap icons over e.g. font-awesome, for consistency. I've noticed that it isn't possible to pass to bsicons::bs_icon() directly to the icon argument of nav_panel(). This is because the internal prepTabIcon() function checks that the icon is a shiny.tag, which bs_icon()s are not.

There is a fairly easy workaround with wrapping it like tags$i(bsicons::bs_icon()), but I think if its possible and easy to implement, allowing bsicons::bs_icon() to be used as a drop-in replacement for shiny::icon() would be useful, especially as the tags$i() workaround isn't immediately obvious (or at least wasn't to me). Thanks!

Minimal example - throws an error when creating the UI:

library(shiny)
library(bslib)
library(bsicons)

ui <- fluidPage(
  page_fluid(
    navset_tab(
      nav_panel(
        title = "First",
        icon = bs_icon("gear") # icon("gear") would work here
      )
    )
  )
)

server <- function(input, output, session) {
  
}

shinyApp(ui, server)
@github-actions
Copy link

This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue.
🙋 Need help? Connect with us on Discord or Posit Community.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant