Skip to content

Configuration

Configure starlight-copy-button in your astro.config.mjs file:

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({
includeTitle: true,
titleLevel: 1,
label: 'Copy page',
successLabel: 'Copied!',
errorLabel: 'Could not copy',
stateDuration: 2800,
}),
],
}),
],
});

Type: boolean
Default: true

Add the page title as a Markdown heading at the top of copied output.

Type: 1 | 2 | 3 | 4 | 5 | 6
Default: 1

Heading level to use when includeTitle is enabled.

Type: string
Default: 'Copy page'

Idle button label.

Type: string
Default: 'Copied!'

Label shown after successful copy.

Type: string
Default: 'Copy failed'

Label shown if clipboard access fails.

Type: number
Default: 2200

How long to show success/error state labels before resetting. Minimum: 400 ms.

Type: boolean
Default: false

Render an icon-only button.