Skip to content

← All components

Foundation and layout

Link

Accessible inline and standalone navigation links.

Live example

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { Link } from "@cofob/design-system-react";

/**
 * Complete Link parameter reference.
 * @param href
 *   type: string
 *   default: —
 *   example: "/guide"
 * @param external
 *   type: boolean
 *   default: false
 *   example: true
 * @param quiet/underline
 *   type: boolean (React) | "always" | "hover" | "none" (Svelte)
 *   default: false / "always"
 *   example: true / "hover"
 * @param children
 *   type: ReactNode | Svelte Snippet | child HTML
 *   default: —
 *   example: children / snippet / child HTML
 * @param anchor attributes
 *   type: native element attributes
 *   default: —
 *   example: class / style / aria-* / data-*
 */
export function LinkExample() {
  return (
    <Link href="/guide">Guide</Link>
  );
}

Svelte

svelte
<script lang="ts">
  import { Link } from "@cofob/design-system-svelte";

  // Complete Link parameter reference.
  // href
  //   type: string
  //   default: —
  //   example: "/guide"
  // external
  //   type: boolean
  //   default: false
  //   example: true
  // quiet/underline
  //   type: boolean (React) | "always" | "hover" | "none" (Svelte)
  //   default: false / "always"
  //   example: true / "hover"
  // children
  //   type: ReactNode | Svelte Snippet | child HTML
  //   default: —
  //   example: children / snippet / child HTML
  // anchor attributes
  //   type: native element attributes
  //   default: —
  //   example: class / style / aria-* / data-*
</script>

<Link href="/guide">Guide</Link>

HTML

html
<!--
  Complete Link parameter reference.
  href
    type: string
    default: —
    example: "/guide"
  external
    type: boolean
    default: false
    example: true
  quiet/underline
    type: boolean (React) | "always" | "hover" | "none" (Svelte)
    default: false / "always"
    example: true / "hover"
  children
    type: ReactNode | Svelte Snippet | child HTML
    default: —
    example: children / snippet / child HTML
  anchor attributes
    type: native element attributes
    default: —
    example: class / style / aria-* / data-*
-->
<a class="cf-link" href="/guide">Guide</a>

<script type="module">
  import { initDesignSystem } from "@cofob/design-system-css";

  const designSystem = initDesignSystem(document);
  window.addEventListener("pagehide", () => designSystem.destroy(), { once: true });
</script>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
hrefstringReact · Svelte · HTML"/guide"Navigation destination; makes Card interactive when provided.
externalbooleanfalseReact · Svelte · HTMLtrueAdds safe new-tab behavior and an external-link affordance.
quiet/underlineboolean (React) | "always" | "hover" | "none" (Svelte)false / "always"React · Svelte · HTMLtrue / "hover"Controls link emphasis and underline behavior for each adapter.
childrenReactNode | Svelte Snippet | child HTMLReact · Svelte · HTMLchildren / snippet / child HTMLIdiomatic adapter composition content.
anchor attributesnative element attributesReact · Svelte · HTMLclass / style / aria-* / data-*Forwards native class/style, accessibility, event, and data attributes to the root element.