npx shadcn@4.23.1 add @goop/trail-linkLink
FreeA text link to another page or place, in running text or on its own, for React and Tailwind CSS. Free, MIT.
What an agent sees
- LinkIconAn icon inside a Link, before its words, or after them with edge set to end
- LinkLabelThe nav row's words, as the row's own box holds them (
variant="nav") - LinkIconSlotThe nav row's icon slot
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>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.
npx shadcn@4.23.1 add @goop/trail-linkAdd the Goop Link to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
| Option | Type | What it does |
|---|---|---|
| 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 |
| Part | What it is |
|---|---|
| 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
| Key | What it does |
|---|---|
| Enter | Follow |
Accessibility
- The part itself answers the keys above.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| 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.
- How the theme moves, and how to move your own parts the same way: Motion.
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.