Render custom router link inside button #404
Replies: 1 comment
-
<RouterLink
v-for="item in sidebarNavItems"
:key="item.title"
:to="item.to"
custom
v-slot="{ isExactActive, href, navigate }"
>
<Button variant="ghost" as-child>
<a
:href="href"
:class="cn('w-full text-left justify-start', isExactActive && 'bg-muted hover:bg-muted')"
:aria-current="isExactActive ? 'page' : undefined"
@click="navigate"
>
{{ item.title }}
</a>
</Button>
</RouterLink> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the settings sidebar im trying to render vue router-link as custom so we can style the exact-active class.
This however will throw the following error.
What happens is that RouterLink renders a fragment with the tag inside and the Button cant pass the props to it.
Beta Was this translation helpful? Give feedback.
All reactions