I have a small reprex of this issue:
# R v4.2.3
# RStudio Pro v2023.06.0
library(shiny) # v1.7.2
library(bslib) # v0.5.0
library(shinyWidgets) # v0.7.6
page_navbar(
header = pickerInput('pickId', choices = month.abb),
title = 'reprex',
nav('tab 1', 'content 1'),
nav('tab 2', 'content 2')
)
The ui will appear fine, but the picker input is greyed out and the drop down will not pop up.
It also does not work if the pickerInput is placed somewhere else in the UI, for example:
page_navbar(
title = 'reprex',
nav_panel('tab 1', 'content 1'),
nav_panel('tab 2', pickerInput('pickId', choices = month.abb))
)
Compare this to a similar example:
page_navbar(
header = selectInput('selectId', 'label', choices = month.abb),
title = 'reprex',
nav_panel('tab 1', 'content 1'),
nav_panel('tab 2', selectInput('selectId2', 'label', choices = month.abb))
)
Which works without issues.
Specifically what technical issue is causing this? How can I make this work? The accepted answer MUST use pickerInput.
This issue seems to be solved within bslib 0.6.0.
The problem may occur due to a compatibility issue between pickerInput()
and bslib
(see also this open issue on GitHub).
However, what seems to let the pickerInput()
work is switching to a theme which relies on another Bootstrap version.
library(shiny)
library(bslib)
library(shinyWidgets)
page_navbar(
theme = bs_theme(version = 3, bootswatch = "default"),
header = pickerInput('pickId', choices = month.abb),
title = 'reprex',
nav_panel('tab 1', 'content 1'),
nav_panel('tab 2', 'content 2')
)