DocsBlogChangelog

ExportedTypes

Displays type documentation for all exported types from a module or source code value.

The ExportedTypes component displays all exported types from a specific source file path or a filename and value. This includes the inferred types from exported declarations, JSDoc descriptions, union types, and more.

import { ExportedTypes } from 'mdxts/components'

<ExportedTypes source="./components/Button.tsx" />

Use a child function to customize the output of ExportedTypes to render type documentation however you like:

<ExportedTypes source="./MDXContent.tsx">
  {(declarations) =>
    declarations.map((declaration) => (
      <div key={declaration.name}>
        <h2>{declaration.name}</h2>
        <p>{declaration.description}</p>
        {declaration.types.length ? (
          <ul>
            {declaration.types.map((type) => (
              <li key={type.name}>
                <h3>{type.name}</h3>
                <p>{type.description}</p>
              </li>
            ))}
          </ul>
        ) : null}
      </div>
    ))
  }
</ExportedTypes>

Examples

Button

children *

React.ReactNode

onPress *

() => void

Function to call when the button is pressed.

usePress

onPress *

() => void

Function to call when the button is pressed.

Basic

MDXContent

Compiles and renders a string of MDX content.

  • value: string
  • components: MDXComponents
  • dependencies: Record<string, any>
  • remarkPlugins: PluggableList
  • rehypePlugins: PluggableList
  • baseUrl: string

Custom

API Reference

ExportedTypes

View Source

ExportedTypesProps

Union

source *

string
or

filename *

string

value *

string

children

( exportedTypes: ReturnType<typeof getExportedTypes> ) => React.ReactNode

Controls how types are rendered.

Last updated