bs4Dash icon indicating copy to clipboard operation
bs4Dash copied to clipboard

Customizing the content of leftUi and rightUi for bs4DashNavbar

Open federicomarini opened this issue 3 years ago • 4 comments

Hi David, After switching from version 0.5.0 to the current 2.0.0 there is a piece of functionality that I'd like to see kept in the new edition of bs4Dash.

In GeneTonic, I am using this configuration

image

This is visible and running at this instance: http://shiny.imbei.uni-mainz.de:3838/GeneTonic/

The new version seems to complain that I am trying to put for example an actionButton (that is essential for "bookmarking features"), or some dropdown elements from shinyWidgets.

The error returned is

 Error in tagAssert(item, type = "li", class = "dropdown") : 
  Expected tag to be of type li 

Can this check be "relaxed"? Or if this is not possible - can you recommend some alternative ways to have such a button?

Thanks in advance! Federico

federicomarini avatar May 26 '21 22:05 federicomarini

If I spot the right location: https://github.com/RinteRface/bs4Dash/blob/4975354cfc0adef974dda546ef008b2da41b8dd8/R/dashboardHeader.R#L62-L80 This part is making a check on being both a "li" and a "dropdown", which would basically enforce this to come from the dropdownMenu. Given that afterwards this is simply put in the dashboard elements, maybe it is not so bad to give the extra freedom - or am I missing some consideration at a higher level for the package?

federicomarini avatar May 26 '21 23:05 federicomarini

Have you made any progress on this issue? I'm struggling with the same thing.

oliviaswarthout avatar Jun 29 '21 15:06 oliviaswarthout

Yes Olivia @oliviaswarthout ! I followed the tip from @DivadNojnarg and basically just avoid using the leftUi and rightUi, so I just place the content in the ... ellipsis. You might need to play around with the placement options of the elements - see e.g. here for an example: https://github.com/federicomarini/GeneTonic/commit/1f4c879dd33cc27dde5d1adee0e66a62862f4854 There might as well be better options, so I'm all ears if someone has a suggestion 😉

federicomarini avatar Jun 29 '21 19:06 federicomarini

@federicomarini @oliviaswarthout

Not sure if I'm too late to the party, but I was having this same issue trying to position a logout button from shinyauthr in the rightUi of the dashboardHeader using bs4Dash. I solved it with the code below! It works without the tagList wrapper too, but this allows more than one element to be easily placed.

,rightUi = tagList(tags$li(class='dropdown', shinyauthr::logoutUI(id = "logout")))

JJohnson-DA avatar Jun 18 '22 23:06 JJohnson-DA