nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
3.4k stars 374 forks source link

Get if ULink is active #1718

Closed JcGuerrero15 closed 3 weeks ago

JcGuerrero15 commented 3 weeks ago

Description

Hi. I'm working with NuxtUI but I have a problem:

I have a navbar with differents ULinks.

image_2024-04-25_120509221

I need to change mi icon name based if my ULink is active. For example: If my ULink is active, I need to change 'i-heroicons-archive-box-x-mark' to 'i-heroicons-archive-box-x-mark-20-solid'

Does exists any way to handle this?

benjamincanac commented 3 weeks ago

You can access the isActive attribute in the slot props:

<ULink v-slot="{ isActive }" :to="to">

</ULink>
JcGuerrero15 commented 3 weeks ago

You can access the isActive attribute in the slot props:

<ULink v-slot="{ isActive }" :to="to">

</ULink>

Thanks. Works like a charm!