Text link
Usage
Use the href prop to set where the link goes, and the label prop to set its text. The default slot replaces the label.
Read the fee schedule before your first international transfer.
<p>Read the <KTextLink label="fee schedule" href="/fees" /> before your first international transfer.</p>
Color
Use the color prop to change the color of the link: inherit (default) takes the color of the text around it, muted suits secondary text like legal notices, and primary stands out as a call to action.
Read the fee schedule or contact support if a payment looks wrong.
By continuing, you agree to the Terms of Service and the Privacy Policy.
Don't have an account? Sign up
<p>
Read the <KTextLink label="fee schedule" href="/fees" /> or
<KTextLink label="contact support" href="/support" /> if a payment looks wrong.
</p>
<p class="text-muted">
By continuing, you agree to the <KTextLink label="Terms of Service" href="/terms" color="muted" /> and the
<KTextLink label="Privacy Policy" href="/privacy" color="muted" />.
</p>
<p>Don't have an account? <KTextLink label="Sign up" href="/sign-up" color="primary" weight="medium" /></p>
Underline
The link is underlined by default, except with the primary color, which is already easy to spot. Set underline to force the underline on, or to false to remove it.
<KTextLink label="Underlined primary" href="#" color="primary" underline />
<KTextLink label="No underline" href="#" :underline="false" />
Weight
Use the weight prop to make the link bolder than the text around it: inherit (default), medium or semibold.
<KTextLink label="Inherit" href="#" />
<KTextLink label="Medium" href="#" weight="medium" />
<KTextLink label="Semibold" href="#" weight="semibold" />
Icon
Use the leading-icon and trailing-icon props to show an icon before or after the label. They take a Lucide icon component, sized to the text.
<script setup lang="ts">
import { ArrowLeft, ArrowRight, ArrowUpRight } from 'lucide-vue-next'
</script>
<template>
<KTextLink
label="Contact support"
href="/support"
weight="semibold"
:underline="false"
:trailing-icon="ArrowRight"
/>
<KTextLink label="Back to log in" href="/login" color="muted" :underline="false" :leading-icon="ArrowLeft" />
<KTextLink
label="Bank website"
href="https://example.com"
color="primary"
underline
:trailing-icon="ArrowUpRight"
/>
</template>
External
A link whose href starts with http:// or https:// opens in a new tab, with rel="noopener noreferrer" and a hidden "(opens in a new tab)" for screen readers. Set external to force this on or off.
<KTextLink label="Bank website" href="https://example.com" color="primary" underline />
<KTextLink label="Same tab" href="https://example.com" :external="false" />
Customization
Use the ui prop to change the classes of each part of the link, and class for the root element. Your classes always win: underline-offset-4 replaces the default underline-offset-[0.1em] instead of being added to it.
<KTextLink label="Wider underline offset" href="#" :ui="{ base: 'underline-offset-4' }" />
API
Props
| Prop | Type | Default |
|---|---|---|
label | string | |
href | string | '#' |
color | 'inherit' | 'muted' | 'primary' | 'inherit' |
weight | 'inherit' | 'medium' | 'semibold' | 'inherit' |
underline | boolean | true, false with primary |
external | boolean | true when href starts with http:// or https:// |
leadingIcon | Component | |
trailingIcon | Component | |
ui | { base?, leadingIcon?, trailingIcon?, newTabHint? } | |
class | string |
Other attributes, like download or aria-label, go to the <a>.
Slots
| Slot | Description |
|---|---|
default | Replaces the label. |