Navigation in Nuxt 3: A Practical Guide to the NuxtLink Component

Navigation in Nuxt 3: A Practical Guide to the NuxtLink Component

In modern web development, interface speed and responsiveness are critical. Users need to instantly switch between client cards, deals, and reports. The `NuxtLink` component in Nuxt 3 makes this effortless—it automatically handles client-side navigation, prefetches the necessary data, and still retains the benefits of universal rendering.

1. Replacing Standard Links

Instead of the standard tag  

<a href="/customers">Clients</a>

  

just use following  

 

<NuxtLink to="/customers">Clients</NuxtLink>

  

This will give us an instant transition, without a full page reload.

 

2. Example: Navigating to a customer profile

Imagine needing to click within the customer list to open the profile card for the customer with ID=42:  

<template v-for="client in clients" :key="client.id">
  <li>
    <NuxtLink :to="/customers/${client.id}">
      {{ client.name }}
    </NuxtLink>
  </li>
</template>

  

The user sees a list, clicks—and the profile data loads client-side without extra requests.

 

3. External links and security (integration with a third-party report)

If you need to send a manager to a Google Analytics report, use NuxtLink with the `external` attribute:  

<NuxtLink
  to="https://analytics.google.com/report"
  external
>
  Go to Analytics
</NuxtLink>

  

NuxtLink will automatically add rel="noopener noreferrer" to prevent security vulnerabilities.

4. Opening in a new tab (sales reports)

Often, it's convenient to view financial reports in a separate tab:  

<NuxtLink
  to="/reports/sales"
  target="_blank"
>
  Sales Report
</NuxtLink>

  

The browser will open a new tab, while we preserve the internal logic of the RouterLink.

5. Preloading Pages (for quick access to client profiles)

To have client card 42 start loading in advance, as soon as it enters the viewport:  

 

<NuxtLink
  :to="/customers/${client.id}"
  prefetch
>
  {{ client.name }}
</NuxtLink>

  

This option is enabled by default. However, if you want to disable preloading for a specific list:  

<NuxtLink :to="/customers/${client.id}" :prefetch="false">...</NuxtLink>
<NuxtLink :to="/customers/${client.id}" no-prefetch>...</NuxtLink>

 

For debugging, you can set the prefetching CSS class:  

<NuxtLink
  to="/customers/42"
  prefetched-class="is-prefetched"
>
  Client view
</NuxtLink>

 

Enable this in development only to monitor the process.

 

6. Custom link component for CRM

To avoid repeating the same settings throughout the project, you can create a `MyCrmLink` component:  

// ~/components/MyCrmLink.ts
export default defineNuxtLink({
  componentName: 'MyCrmLink',
  activeClass: 'crm-link--active',
  prefetchedClass: process.env.NODE_ENV === 'development'
    ? 'crm-link--prefetched'
    : undefined
});

 

Now you can use it in your code:  

<MyCrmLink to="/customers">Clients</MyCrmLink>

 

and automatically get consistent styling and the necessary classes.

Conclusion

NuxtLink is an indispensable tool for any Nuxt 3-based system. It smooths out navigation, speeds up access to key sections, and ensures security when interacting with external services. Use the built-in component or create your own using `defineNuxtLink` to make navigation within your CRM fast, user-friendly, and consistent.

Popular Posts

My most popular posts

Maximum productivity on remote job
Business

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, Vue.js, Wordpress. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form

Telegram
@sergeyem
Telephone
+4915211100235
Email