Skip to content

Getting Started

starlight-copy-button adds an accessible, polished copy button next to each docs page title in Starlight.

  1. Install starlight-copy-button from GitHub:

    Terminal window
    pnpm add github:dionysuzx/starlight-copy-button
  2. Add the plugin to your Starlight plugins config:

    astro.config.mjs
    import starlight from '@astrojs/starlight'
    import { defineConfig } from 'astro/config'
    import starlightCopyButton from 'starlight-copy-button'
    export default defineConfig({
    integrations: [
    starlight({
    title: 'My Docs',
    plugins: [starlightCopyButton()],
    }),
    ],
    })
  3. Start your docs site in dev mode and open any docs page:

    Terminal window
    pnpm dev

The plugin:

  • Injects client behavior to copy full page Markdown to the clipboard.
  • Adds starlight-copy-button/styles.css to your Starlight customCss.
  • Skips pages that use Starlight’s hero title layout.