Mischief

10 / Docs

Copy for AI

Hands the page to an assistant as markdown, by clipboard, by link, or by opening it somewhere that can read it.

Live previewSource

Installation

Copy the source into your project, or keep it behind a package.

npx shadcn@latest add Tinkerers-Labs/mischief-ui/copy-for-ai
import { CopyForAi } from "mischief-ui/copy-for-ai"

Usage

export function PageActions({ markdown }: { markdown: string }) {
  return (
    <CopyForAi
      markdown={markdown}
      markdownUrl="https://example.com/docs/tabs.md"
    />
  )
}

API

markdownstringThe page as markdown. This is what the button copies.
markdownUrlstringWhere the same markdown is served. Adds a link and points destinations at it.
promptstringWhat a destination is asked to do. Defaults to reading the markdown address.
destinationsAiDestination[]Where the page can be opened. Defaults to ChatGPT and Claude.
copyLabel, copiedLabel, viewLabel, menuLabelstringCopy for the button and the menu.

Accessibility

Copying is a button and every destination is a link, so each behaves the way its shape promises. The menu closes on Escape and on a click outside it, and the copy is announced through a polite live region rather than only changing an icon. Destinations open in a new tab and are marked so they are not followed.

Dependencies

  • lucide-react