Closed peter-tell closed 9 months ago
In v5.3.0 you can use isActive
property to set the active state
{
title: 'My Route',
icon: { element: MegaphoneIcon },
child: [
{
href: '/my-route',
title: 'My Route',
isActive: (item) => page.url.startsWith(item.href),
},
],
},
Brilliant thank you! For anyone referencing this task in the future I ended up with:
isActive: (item) => { return router.page.url.startsWith(item.href); },
Since I'm using Inertia
For example, I have a route in Laravel that looks like this:
Route::get('/my-route/{tab?}', [MyControllerController::class, 'index'])->name('my.route');
My menu config looks like this:
I'm also using the following link-component-name:
My goal is that if someone visits any of these: /my-route /my-route/anything
This navigation item is expanded and each of the active states on the parent and child are set. Using the customLink referenced above I'm able to set the active state, but the navigation item is not expanded.