Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Components / Navigation

Link

A styled native anchor or Vue router link that preserves link behavior.

Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.

Interactive showcase

Weekly performance report

Revenue is up 18% compared with the previous period.

View full report

Install

Run in your project
bunx --bun @getweini/cli@latest add link

Start with this example

Import the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.

Vue
<script setup lang="ts">
import Link from './components/ui/link/Link.vue'
</script>

<template>
  <p>Read the&nbsp;<Link href="/guides/getting-started">getting started guide</Link>.</p>
</template>

Native anchor attributes and events pass through. In Nuxt, use :as="NuxtLink" with to for client-side navigation.

When to use it

Page navigation

Use a styled native anchor to reach another route.

External resource

Link to a separate site with clear destination text.

More examples

Inline route

Use NuxtLink for the route and Link for the Weini anchor treatment.

Inline route
<script setup lang="ts">
import { NuxtLink } from '#components'
import Link from './components/ui/link/index.vue'
</script>

<template>
  <p>
    Read the&nbsp;<Link :as="NuxtLink" to="/guides/export">export guide</Link> before downloading.
  </p>
</template>

A muted variant can sit beside a primary form action.

Quiet secondary link
<script setup lang="ts">
import Link from './components/ui/link/Link.vue'
</script>

<template>
  <Link href="/account/help" variant="muted" size="sm">Need help signing in?</Link>
</template>

Complete API

Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.

Complete API for Link
NameType or signatureDefaultWhat it does
Public type definitions
Public types
// packages/frameworks/vue/components/link/types.ts
// ------- IMPORTS -------

import type { Component } from 'vue'
import type { linkSizes, linkVariants } from './styles'

// ------- TYPES -------

export interface LinkProps {
  href?: string
  as?: 'a' | Component
  asChild?: boolean
  variant?: keyof typeof linkVariants
  size?: keyof typeof linkSizes
}


// packages/frameworks/vue/components/link/styles.ts
// Edit the native link's appearance here; public visual prop types follow the map keys.
export const linkVariants = {
  default:
    'text-primary underline decoration-primary/40 underline-offset-4 hover:decoration-current',
  muted:
    'text-muted-foreground underline decoration-current/35 underline-offset-4 hover:text-foreground',
  plain: 'text-foreground hover:text-primary',
} as const

export const linkSizes = { sm: 'text-sm', md: 'text-base', lg: 'text-lg' } as const

Implementation notes

  • Use href for navigation; choose Button for an action that stays on the page.
  • Native anchor attributes such as target and rel pass through.

Accessibility and localization

  • Avoid vague text such as “click here”; describe the destination in the link text.

Source contract and editing guidance