---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Link

A text link to another page or place, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Link`.

## Try it

Switch every look and size, the inline link’s arrow, an icon before or after, long words; press it (or Enter) and the count goes up instead of leaving the page.

The link goes nowhere: its press is counted and stopped.

## When to use

- A text link to another page or place.

## When not to use

- For an action that stays on the page use Button.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Link on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/meadow-link
```

```text
Add the Goop Link to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { LinkIcon, LinkLabel, LinkIconSlot } from '@/components/ui/goop/link';

import { Link } from '@/components/ui/goop/link';

function SitePages() {
  return (
    <nav aria-label="Site pages" className="flex flex-col w-48">
      <Link href="/sites/north-field" className="w-full">
        Survey
      </Link>
      <Link href="/sites/orchard" variant="plain" className="w-full">
        Orchard drainage plan
      </Link>
      <Link href="https://example.com/permits" external>
        Permit office
      </Link>
    </nav>
  );
}

function VisitNote() {
  return (
    <p className="text-base">
      The crew meets at the{' '}
      <Link variant="inline" href="/sites/north-field/gate">
        north gate
      </Link>{' '}
      at eight.
    </p>
  );
}
```

- A standing link is as wide as its words; in a column that cuts it, give it the column (`className="w-full"`) and its words end in an ellipsis. On a touch screen a standing link is at least 44 px high by itself, no prop.
- height, width, padding, corner, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `variant: muted | plain | inline | default | ghost | accent | nav | outline | crumb | primary | cell | meta = muted`
- `size: sm | md | lg = md`
- `asChild?: boolean = false` — Render the link's look on the one child element instead of an `a` (a router's own anchor).
- `external?: boolean = false` — The link leaves the app: it opens in a new tab, with rel="noreferrer noopener", and shows the pack's arrow.
- `arrow?: 'up-right' | 'right'` — The arrow after the words: `up-right` (an external link's) or `right` (a link to a page of the app).
- `mark?: ReactNode` — The crumb's leading icon, yours, in a 16 px box before the words (`variant="crumb"`).
- `href?: string`

### Parts

- `LinkIcon` — An icon inside a Link, before its words, or after them with edge set to end; icon: IconName — A pack icon name; edge?: 'start' | 'end' = 'start' — Before the words (a page's own icon) or after them (an arrow); box?: { w: number; h: number } — The glyph's box in CSS px, `{ w, h }`: 14 by 14 (12 by 12 at the end) unless the caller sizes it
- `LinkLabel` — The nav row's words (`variant="nav"`)
- `LinkIconSlot` — The nav row's icon slot

- Class recipes (cva): linkVariants (Link)
- data-slot values (to select a part by): link, link-icon, link-label

## Keyboard

- Enter: follow

## Accessibility

- The part itself answers the keys above.
- hover, active, focus, focus-visible: the browser's own (:hover, :active, :focus, :focus-visible): write nothing
- expanded: the attribute data-state=open
- open: the attribute data-state=open
- current: the attribute aria-current=page
- disabled: the attribute aria-disabled=true

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Button](/themes/meadow/components/button): A button with words that runs an action, in several looks and sizes, on a page, in a row or in a sidebar.
- [Copy button](/themes/meadow/components/copy-button): A button that copies a value such as a link, a key or a command to the clipboard and says it was copied in place.
- [Menu button](/themes/meadow/components/menu-button): The button a menu opens from, shown as words, a workspace's tile or an icon.
- [Color mode toggle](/themes/meadow/components/color-mode-toggle): The app's light and dark mode switch.
