Link Link
LhLink text link: semantic colors, underline variants and disabled state with icon slots.
Basic Usage
Basic Usage
vue
<script setup lang="ts">
import { LhLink } from '@lh-ui/vue3'
</script>
<template>
<div class="demo-row">
<LhLink href="https://www.lhgb.top">Default link</LhLink>
<LhLink href="https://www.lhgb.top" type="primary" target="_blank">Primary (new tab)</LhLink>
</div>
</template>vue
<script>
import { LhLink } from '@lh-ui/vue3'
export default {
components: { LhLink },
}
</script>
<template>
<div class="demo-row">
<LhLink href="https://www.lhgb.top">Default link</LhLink>
<LhLink href="https://www.lhgb.top" type="primary" target="_blank">Primary (new tab)</LhLink>
</div>
</template>Types & Underline
vue
<script setup lang="ts">
import { LhLink } from '@lh-ui/vue3'
</script>
<template>
<div class="demo-row">
<LhLink type="success">Success</LhLink>
<LhLink type="warning">Warning</LhLink>
<LhLink type="danger" underline="always">Always underlined</LhLink>
<LhLink underline="none">No underline</LhLink>
</div>
</template>vue
<script>
import { LhLink } from '@lh-ui/vue3'
export default {
components: { LhLink },
}
</script>
<template>
<div class="demo-row">
<LhLink type="success">Success</LhLink>
<LhLink type="warning">Warning</LhLink>
<LhLink type="danger" underline="always">Always underlined</LhLink>
<LhLink underline="none">No underline</LhLink>
</div>
</template>Disabled
Disabled link (not clickable)
vue
<script setup lang="ts">
import { LhLink } from '@lh-ui/vue3'
</script>
<template>
<LhLink disabled>Disabled link (not clickable)</LhLink>
</template>vue
<script>
import { LhLink } from '@lh-ui/vue3'
export default {
components: { LhLink },
}
</script>
<template>
<LhLink disabled>Disabled link (not clickable)</LhLink>
</template>Link API
Props
| Name | Description | Type | Default |
|---|---|---|---|
| href | Link URL (omitted when disabled) | string | — |
| target | Target window (e.g. _blank) | string | — |
| type | Semantic type | "default" | "primary" | "success" | "warning" | "danger" | "info" | — |
| underline | Underline variant: always / hover / none | "always" | "hover" | "none" | 'hover' |
| disabled | Disabled: renders as span without href | boolean | false |
| current | Current marker (emits aria-current) | true | "page" | "location" | — |
| sx | Quick layout props | LhSxProps | — |
Events
| Name | Description | Type |
|---|---|---|
| click | Fired on click | (event: MouseEvent) |
Slots
| Name | Description |
|---|---|
| default | Link text |
| prefix | Prefix icon slot |
| suffix | Suffix icon slot |
Accessibility
- When disabled,
aria-disabled="true"withrole="link"keeps the link semantics
Type Definitions
The TypeScript type structures exported by this component (auto-extracted from packages/components/link/src/types.ts and @lh-ui/share/core/* sources; click each entry to expand; see the Props table above for attribute descriptions):
LhLinkProps
ts
export interface LhLinkProps {
href?: string
target?: string
type?: LhLinkType
underline?: LhLinkUnderline
disabled?: boolean
current?: 'page' | 'location' | true
sx?: LhSxProps
}
