---
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, in running text or on its own, 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, in running text or on its own.

## 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/trail-link
```

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

## Usage

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

<p>
  New here?{' '}
  <Link variant="inline" href="/docs" arrow="up-right">
    Read the docs
  </Link>
</p>
```

- Fits: account, record (their recipes).
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `variant: default | ghost | inline | accent | nav | plain | outline | crumb | primary | muted | cell | meta = default`
- `size: sm | md | lg = md`
- `asChild?: boolean = false` — Render the link's look on your one child element (a router's anchor).
- `mark?: ReactNode` — The crumb's leading icon, yours, in a 16 px box before the words.
- `arrow?: 'up-right' | 'right' = 'up-right'` — The inline link's arrow: `up-right`, or `right` for a single 12 px link to a page of the app.
- `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 back chevron) or after them (an arrow); box?: { w: number; h: number } — The glyph's box in CSS px, `{ w, h }`: 14 by 14 (16 by 16 at the end) unless given
- `LinkLabel` — The nav row's words, as the row's own box holds them (`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-visible: the browser's own (:hover, :active, :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

## 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/trail/components/button): A button with words that runs an action, in several looks and sizes.
- [Copy button](/themes/trail/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/trail/components/menu-button): The button a menu opens from, shown as words, a workspace's tile or an icon.
- [Color mode toggle](/themes/trail/components/color-mode-toggle): The app's switch between light and dark, as a button or a menu.
