Skip to content

feat(theme-docs): allow configuring copy page labels - #5016

Open
robinv8 wants to merge 2 commits into
shuding:mainfrom
robinv8:feat/copy-page-labels-config
Open

feat(theme-docs): allow configuring copy page labels#5016
robinv8 wants to merge 2 commits into
shuding:mainfrom
robinv8:feat/copy-page-labels-config

Conversation

@robinv8

@robinv8 robinv8 commented Jun 17, 2026

Copy link
Copy Markdown

Why

The docs theme lets users customize several visible labels, but the CopyPage control still hardcodes English text for the button and menu. This makes it difficult for localized docs sites to translate the copy page UI without patching or replacing the component.

Related: #4772, #4780

What changed

  • Add a copyPage layout config object for CopyPage labels.
  • Use the configured labels in the CopyPage button and menu.
  • Keep existing English labels as defaults for backward compatibility.
  • Update generated LayoutProps and TSDoc snapshots.

Checks

  • pnpm exec prettier --config packages/prettier-config/src/index.js --check .changeset/curly-walls-copy.md packages/nextra-theme-docs/src/components/copy-page.tsx packages/nextra-theme-docs/src/schemas.tsx packages/nextra-theme-docs/src/types.generated.ts packages/tsdoc/src/__tests__/snapshots/layout-props.ts packages/tsdoc/src/__tests__/snapshots/layout-props.json packages/tsdoc/src/__tests__/snapshots/use-theme-config.json
  • pnpm exec eslint --config packages/eslint-config/src/index.ts packages/nextra-theme-docs/src/components/copy-page.tsx packages/nextra-theme-docs/src/schemas.tsx
  • pnpm --filter nextra-theme-docs test -- --run src/__tests__/layout-props.test-d.ts
  • pnpm --filter nextra-theme-docs types:check
  • pnpm --filter nextra-theme-docs build

Note: I also ran pnpm --filter @nextra/tsdoc test -- --run src/__tests__/base.test.ts -u to refresh the relevant API snapshots. It updated the copyPage snapshots, but that full test file still has unrelated existing failures for NotFoundPage, Navbar, and useConfig resolution in this local checkout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant