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

nav_spacer() should support a value parameter for it to be compatible with nav_insert()/nav_remove() #1106

Open
DeepanshKhurana opened this issue Aug 28, 2024 · 1 comment

Comments

@DeepanshKhurana
Copy link

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.

@DeepanshKhurana DeepanshKhurana changed the title nav_spacer() should support a value parameter for it to be compatible with nav_insert()/nav_remove() nav_spacer() should support a value parameter for it to be compatible with nav_insert()/nav_remove() Aug 28, 2024
@DeepanshKhurana
Copy link
Author

DeepanshKhurana commented Aug 28, 2024

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

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

1 participant