`nav_spacer()` should support a `value` parameter for it to be compatible with `nav_insert()`/`nav_remove()`
Opened this issue · 1 comments
I have a navset_tab()
that I programmatically want to generate and regenerate based on server logic. While I am able to set the nav_panel()
s perfectly using nav_insert()
, I am having trouble with the following layout.
- Main
- Menu1
- Menu2
- Spacer
- Menu3
- Menu4
Now, that Spacer in between gets rendered perfectly on the first go. But then, when I need to regenerate the menu, I cannot remove it using nav_remove()
since that needs a value to be passed in the target
.
Setting a value on the nav_spacer()
gives me an unused argument
warning.
I have also tried something as follows, with different variations:
nav_spacer() |>
tagAppendAttributes(value = "spacer")
nav_spacer() |>
tagAppendAttributes(`data-value` = "spacer")
nav_spacer() |>
tagAppendAttributes(`data-value` = "spacer", class = "nav-link")
It would be nice to give the spacer a value and have it behave like the other nav_panel()
s to structure more creative menus (some options on the left, others on the right) and then programmatically change them as the user wants and interacts with the app.
From what I can see, the only thing that limits it is the behaviour. Instead of being a proper li
item, it is a div
, and it does not have a data-value
.
This would be useful to have.
Meanwhile, for someone looking for an alternative to work with, the following CSS will work.
li.nav-item:nth-last-child(N) {
margin-left: auto;
}
where N
is position from the side where you need to split the tabs from.
- Main
- Menu1
- Menu2
- Spacer
- Menu3 (N = 2)
- Menu4