Skip to main content
Type-safe links to API reference pages with compile-time TypeScript validation and runtime checking.

Basic Usage

import { RefLink } from "/snippets/tsdocs/RefLink.jsx"

<RefLink target="mint-tsdocs.MarkdownDocumenter" />
mint-tsdocs.MarkdownDocumenter With custom text:
<RefLink target="mint-tsdocs.CacheManager">caching system</RefLink>
Custom link text
Learn more about the caching system.

Properties

target
string
required
API reference ID: PackageName.ClassName.MemberNameExamples: mint-tsdocs.MarkdownDocumenter, mint-tsdocs.loadConfig, mint-tsdocs.CacheManager.typeAnalysis
children
ReactNode
Link text. Defaults to the API item name if omitted.

Type Safety

RefLink validates links in two ways: Compile-time - TypeScript checks against ValidRefs.d.ts:
<RefLink target="mint-tsdocs.MarkdownDocumenter" /> // ✅ Valid
<RefLink target="mint-tsdocs.NonExistent" />        // ❌ Type error
Runtime - Browser checks against ValidRefs Set and applies styling:
Valid vs broken links
❌ Broken: NonExistentClass
Broken links get:
  • Red color (#ef4444)
  • Red dotted underline (2px)
  • Red wavy text decoration
  • Tooltip showing the error
Learn more: Link Validation

Examples

RefId Format

API reference IDs follow: PackageName.ClassName.MemberName Examples:
  • Class: mint-tsdocs.MarkdownDocumenter
  • Method: mint-tsdocs.MarkdownDocumenter.generateFiles
  • Interface property: mint-tsdocs.MintlifyTsDocsConfig.entryPoint
Path generation: mint-tsdocs.MarkdownDocumenter/reference/mint-tsdocs/MarkdownDocumenter Links break when API items are renamed, deleted, or not exported.
  1. Check TypeScript error in IDE
  2. Verify item exists in API reference navigation
  3. Update target to correct RefId
  4. Run mint-tsdocs generate if source changed

Best Practices

Use RefLink for API references, PageLink for guides/concepts
Keep link text concise
Let TypeScript autocomplete guide you
Fix broken links before committing

Troubleshooting

Run mint-tsdocs generate to copy components to docs/snippets/tsdocs/
Due to an MDX extension bug, try:
  1. Use relative path while editing: "../snippets/tsdocs/RefLink.jsx"
  2. Get autocomplete
  3. Change back to absolute: "/snippets/tsdocs/RefLink.jsx"