/
1.1k
Sponsor

Link

OSC 8 clickable hyperlink

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/ink/link

Usage

import { Link } from "@/components/ui/link";
<Link href="https://github.com">GitHub</Link>

Examples

Show URL and terminals without OSC 8

showHref appends the URL in dim text. When the terminal does not support OSC 8 hyperlinks, the same fallback is used unless you set fallback={false} or pass a custom fallback function.

Terminal
import { Box } from "ink";

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

export function LinkShowHref() {
  return (
    <Box flexDirection="column" gap={1}>
      <Link href={SITE.URL}>termcn</Link>
      <Link href="https://github.com/vadimdemedes/ink" showHref>
        Ink
      </Link>
    </Box>
  );
}

API Reference

PropTypeDefault
childrenReactNoderequired
hrefstringrequired
colorstring-
showHrefbooleanfalse
fallbackboolean | ((text: string, url: string) => string)true

Notes

Accessibility

termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.

  • Keyboard: Enter / Space activate the focused action when enabled; Escape dismisses or cancels when supported; Tab / Shift+Tab move through Ink focus targets.
  • Focus and composition: Input is active only while the component's focus target is focused, enabled, active, and inside the topmost focus scope.
  • Screen reader: Ink labels and semantic state expose the component without relying on visual styling alone.