Skip to content

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Dec 13, 2025

Resolves: N/A

Description

Important

This is an internal change. Do not use this feature directly in your website.

This PR allows for globally configuring the internal link component rendered by <PrismicLink> and <PrismicRichText>.

The default behavior does not change when using @prismicio/react directly; links will continue to render <a> by default.

This feature is intended for external packages to set default internal links. For example, @prismicio/next can set the default internal link to next/link.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

Somewhere in a module:

// The "@prismicio/react/config" key is important
globalThis[Symbol.for("@prismicio/react/config")] = {
	internalLinkComponent: (props) => (
		<a data-foo {...props} />
	),
};

The following components will now render internal links as <a data-foo {...props} />:

<PrismicLink field={...} />
<PrismicRichText field={...} />

How to QA 1

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

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.

2 participants