npx shadcn@4.23.1 add @goop/meadow-linkLink
FreeA text link to another page or place, 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 (
variant="nav") - LinkIconSlotThe nav row's icon slot
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>
);
}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.
npx shadcn@4.23.1 add @goop/meadow-linkAdd the Goop Link to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
| Option | Type | What it does |
|---|---|---|
| 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 |
| 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 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
| Key | What it does |
|---|---|
| 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
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=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.