Veil UI
Components

Link

Inline text links with underline styling and safe external defaults.

Installation

$ npx veil-ui@latest add link

Usage

import { Link } from "@/components/ui/link";

<Link href="/docs">Read the documentation</Link>;

For links that look like buttons, use Link Button instead.

Examples

Basic

External

Muted

API reference

PropTypeDefaultDescription
externalbooleanfalseOpens in a new tab with rel=noopener noreferrer.
tone"default" | "muted""default"Foreground color tone.
...propsAnchorProps—All native anchor attributes.

Accessibility

  • Always underlined, so links are distinguishable without relying on color.
  • External links open in a new tab with noopener noreferrer to protect the opener page.
  • A visible focus ring is rendered for keyboard users.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add link --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { computed } from "vue";

import { cn } from "@/lib/utils";

const props = withDefaults(
  defineProps<{
    href?: string;
    external?: boolean;
    tone?: "default" | "muted";
    target?: string;
    rel?: string;
    class?: string;
  }>(),
  { external: false, tone: "default" },
);

const resolvedTarget = computed(() =>
  props.target ?? (props.external ? "_blank" : undefined),
);
const resolvedRel = computed(() =>
  props.rel ?? (props.external ? "noopener noreferrer" : undefined),
);

const classes = computed(() =>
  cn(
    "rounded-sm font-medium underline decoration-muted-foreground/40 underline-offset-4 transition-colors hover:decoration-current focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
    props.tone === "muted" && "text-muted-foreground hover:text-foreground",
    props.class,
  ),
);
</script>

<template>
  <a
    data-slot="link"
    :href="props.href"
    :target="resolvedTarget"
    :rel="resolvedRel"
    :class="classes"
  >
    <slot />
  </a>
</template>

On this page