Link Preview, animated React component
An inline link that lifts a preview card out of the text on hover or keyboard focus. The card rises with a stretch and settles, leans and slides as the pointer moves along the link, and draws its own cover from the title and site when no image is given. Also includes Cursor Card: A preview card trails your cursor through a project list, leans into your movement and swaps content row to row without disappearing.
- Free
- Motion Effects
- Hover
- Spring
Link Preview
Cursor Card
Like Link Preview? 256 more are in Pro.
Pro unlocks all 256 Pro components, every template and block, and everything we release next. Link Preview stays free.
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Read the spring guide before you tune the motion, then ship it.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| href | string | — | Destination: an internal path or a full URL. |
| children | React.ReactNode | — | The link text. |
| image | string | — | Picture for the card. Without one the card draws a cover from the title and site name. |
| title | string | — | Card heading. |
| description | string | — | One or two lines under the heading. |
| width | number | 300 | Card width in px. |
| height | number | 168 | Height of the picture area in px. |
| delay | number | 0.08 | Wait before the card rises, in seconds. |
| open | boolean | — | Controls the card from outside. Leave unset to open on hover and focus. |
| autoplay | boolean | false | Opens and closes the card on its own until someone hovers or focuses the link. |
| openInNewTab | boolean | true | Opens the link in a new tab. |
| className | string | — | Extra classes for the link. |
| previewClassName | string | — | Extra classes for the floating card. |
| CursorCard.items | CursorCardItem[] | CURSOR_CARD_ITEMS | Cursor Card: the rows of the list, each { title, kind, year, colors: [from, to], href? }. Rows without an href only drive the card. |
| CursorCard.ctaLabel | string | "View case study" | Cursor Card: text of the call to action at the foot of the card. |
| CursorCard.autoplay | boolean | false | Cursor Card: the card visits each row in turn until someone points at the list or focuses a row. Never runs under reduced motion. |
| CursorCard.className | string | — | Cursor Card: extra classes for the wrapper. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry
Run this once per project. It writes the Nexus UI entry into
components.jsonfor you:npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"Type it exactly as shown.
{name}is filled in by the CLI with the component you ask for, so you never replace it.
- 3
Add the component
Run this from your project root. It adds the component, the helpers it imports and its npm packages.
npx shadcn@latest add @nexus-labs/link-preview
- 4
Check what was added
With a project made as in the Quick Start (a
src/folder), these files land in it:components/link-preview/cursor-card.tsxindex.tslink-preview.tsx - 5
Copying by hand? Skip the registry
Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that
cn()exists. Install the packages:npm install framer-motion
Then show the source and create each file at the path it gives:
- 6
Use it in a page
Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:
// src/app/page.tsx import { LinkPreview } from "@/components/link-preview"; export default function Page() { return ( <main> <LinkPreview /> </main> ); }
Like Link Preview? 256 more are in Pro.
Pro unlocks all 256 Pro components, every template and block, and everything we release next. Link Preview stays free.