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

Ability to set custom active class on Navigate component #78

Open
davidjbeaver opened this issue Aug 11, 2020 · 1 comment
Open

Ability to set custom active class on Navigate component #78

davidjbeaver opened this issue Aug 11, 2020 · 1 comment

Comments

@davidjbeaver
Copy link

Apologies if this has been mentioned before, but nothing quite like it in the existing issues list.

It would be handy if we could set a custom active class through the options when initializing the router.

Something similar to

{ "active-class" : "is-active"}

Currently it defaults to "active" but for many css libraries out there the active class for links has in built highlight for class names other than "active" (I use Bulma mainly which uses the "is-active" class).

I am happy to provide a pull request if you like, as I think it would be a simple case of adding another export to the spa_router for "activeClass" and then using this within the Navigate component.

@jorgegorka
Copy link
Owner

Hi @davidjbeaver

Here you can find an example for routeIsActive a helper that you can use to see if the current route is the active one.

https://github.com/jorgegorka/demanda/blob/master/frontend/src/views/protected/admin/layout/main_menu/item.svelte

Hope it helps.

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

2 participants