tinkerers-labs

Link Preview

Navigation

About

An inline link that shows where it leads before you follow it: an image, the title, a description, and the domain.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Link Preview to your project and fits it to your theme.

Code

How Link Preview is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import {
  LinkPreview,
  type LinkPreviewData,
} from "@/components/ui/mischief-link-preview"

const pages: Record<string, LinkPreviewData> = {
  "/docs/components/floating-index": {
    title: "Floating Index",
    description:
      "A compact outline for long pages. It keeps the active section and reading progress visible without becoming another permanent sidebar.",
    image: "/demo/gallery/floating-index.png",
  },
  "/docs/components/shift-button": {
    title: "Shift Button",
    description:
      "A call to action that trades its leading icon for a directional cue when someone approaches it.",
    image: "/demo/gallery/shift-button.png",
  },
}

async function loadPreview(href: string) {
  await new Promise((resolve) => setTimeout(resolve, 700))
  const page = pages[href]
  if (!page) throw new Error(`No preview for ${href}`)
  return page
}

export default function LinkPreviewDemo() {
  return (
    <div className="w-full max-w-[34rem] text-sm leading-relaxed">
      <p>
        Long pages need a way to see where you are. The{" "}
        <LinkPreview
          href="/docs/components/floating-index"
          loadPreview={loadPreview}
        >
          Floating Index
        </LinkPreview>{" "}
        keeps the outline close without taking a column, and a{" "}
        <LinkPreview
          href="/docs/components/shift-button"
          preview={pages["/docs/components/shift-button"]}
        >
          Shift Button
        </LinkPreview>{" "}
        at the end tells people what comes next.
      </p>
      <p className="text-muted-foreground mt-3 text-xs">
        Rest the pointer on a link, or tab to it. The first preview loads, the
        second is already known. On a touch screen the links simply open.
      </p>
    </div>
  )
}

More by tinkerers-labs

View all
  • Prompt Input

    Prompt Input

    11
  • Burst

    Burst

    4
  • Quantity Button

    Quantity Button

    1
  • Undo Button

    Undo Button

  • Tool Approval

    Tool Approval

  • Notification Stack

    Notification Stack

  • Swipe Actions

    Swipe Actions

  • Sparkline

    Sparkline

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    171
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    449
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    33
  • Sidebar

    Sidebar

    444
  • Stacked Circular Footer

    Stacked Circular Footer

    470
  • Tabs

    Tabs

    38
  • Sidebar

    Sidebar

    367
  • Footer Section

    Footer Section

    3