# Link
A text link: semantic colors, underline variants and a disabled state, with prefix / suffix icon slots. When disabled it renders as a span and does not navigate; screen readers still announce it as a link while making it clearly unavailable.
Link
<template>
<div class="demo-col" style="gap: 18px">
<div class="demo-row" style="gap: 16px; flex-wrap: wrap">
<LhLink href="https://www.lhgb.top" target="_blank">Default link</LhLink>
<LhLink type="primary" href="https://www.lhgb.top" target="_blank">Primary link</LhLink>
<LhLink type="success">Success</LhLink>
<LhLink type="warning">Warning</LhLink>
<LhLink type="danger" underline="always">Always underlined</LhLink>
<LhLink type="info" underline="none">No underline</LhLink>
</div>
<div class="demo-row" style="gap: 16px; flex-wrap: wrap">
<LhLink disabled>Disabled link (no response to clicks)</LhLink>
<LhLink href="https://www.lhgb.top" @click.prevent="onClicked">
<template #prefix>→</template>
Prefix / suffix icon slots
<template #suffix>←</template>
</LhLink>
</div>
<p class="demo-note">
{{ clicked ? 'Default navigation intercepted, click event fired' : 'Click "Prefix / suffix icon slots" to fire click (default navigation prevented)' }}
</p>
</div>
</template>
<script>
export default {
data: () => ({
clicked: false,
}),
methods: {
onClicked() {
this.clicked = true
},
},
}
</script>
# Props
| Prop | Description | Type | Default |
|---|---|---|---|
| href | Link URL (href is not rendered when disabled) | string | — |
| target | Target window (e.g. _blank) | string | — |
| type | Semantic type | 'default' \| 'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' | 'default' |
| underline | Underline variant: always / hover / none | 'always' \| 'hover' \| 'none' | 'hover' |
| disabled | Disabled: renders as a span and does not navigate | boolean | false |
| current | Current page / current location marker (outputs aria-current) | true \| 'page' \| 'location' | — |
| sx | sx shorthand layout props | — | — |
# Events
| Event | Description | Callback args |
|---|---|---|
| click | Emitted when the link is clicked (not emitted while disabled) | (event: MouseEvent) |
# Slots
| Slot | Description |
|---|---|
| default | Link text |
| prefix | Prefix icon slot |
| suffix | Suffix icon slot |
# Accessibility
- When disabled it outputs
aria-disabled="true"and keepsrole="link" - When
currenthas a value it outputsaria-current(e.g. the current page in a breadcrumb)
← Breadcrumb Pagination →
Copyright © 2024-2026 FengMo WenXue