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

How to add a custom element next to a specific existing navbar element? #3930

Open
4 tasks done
jkrumbiegel opened this issue May 29, 2024 · 2 comments
Open
4 tasks done
Labels
enhancement New feature or request theme Related to the theme

Comments

@jkrumbiegel
Copy link

Is your feature request related to a problem? Please describe.

On our page, we have this navbar section currently:
image

I want to have a version selector between Resources and the dark/light toggle preferably. The existing slots nav-bar-title-before, nav-bar-title-after, nav-bar-content-before, nav-bar-content-after can only put elements outside of the navbar flow or at the least not at the position I'd like. I have not found a way yet to splice components into specific places in the layout.

The version picker can only be populated at load time because it has to read a javascript file from the server, so I can't just add it as a normal menu, although I want it to look like one.

Describe the solution you'd like

Ideally I'd want some way to access the navbar elements like an array, putting a custom component into it in a position I decide, without having to clone and modify the complete theme.

Describe alternatives you've considered

I've only found issues where people wanted to replace the elements in the navbar with their own implementations completely, not one where you'd be able to place additional elements.

Additional context

No response

Validations

@brc-dd
Copy link
Member

brc-dd commented May 29, 2024

Not a stable option, but you can patch VPNavBar.vue using a vite alias / plugin or pnpm patch / patch-package to add an extra component after VPNavBarMenu.

@brc-dd brc-dd added enhancement New feature or request theme Related to the theme labels Jun 27, 2024
@userquin
Copy link
Collaborator

Not easy, maybe we can add a few more slots (then we'll have some problems with styles): check this PR to add just a new switcher unocss/unocss#3931

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request theme Related to the theme
Projects
None yet
Development

No branches or pull requests

3 participants