TypeTree component provides an elegant way to document complex type structures with nested properties. It automatically handles recursive rendering and provides an intuitive expandable interface for exploring deeply nested types.
Basic Usage
Import the component and pass it the type information.TypeTree usage
TypeTree component will recurse through the properties using the
ResponseField
and Expandable
Mintlify components to display the type information.
TypeTree Preview
Using the Auto-generated TypeInfo
When you runmint-tsdocs generate, it automatically creates a TypeInfo.jsx file containing structured type information for all documented API items. This makes it incredibly easy to document your types with full IDE autocomplete support.
Learn more about TypeInfo in the comprehensive TypeInfo guide, including how to explore available types, access nested properties, and best practices.
Quick Start
Simply import TypeInfo and spread it into a TypeTree component:Document any type from your API
TypeInfo.PackageName.TypeName, where package names are converted to PascalCase. For example, mint-tsdocs becomes MintTsdocs.
Live Example
Here’s the completeResolvedConfig type from mint-tsdocs, automatically generated with full nested documentation:
Auto-generated from TypeScript source
IDE Autocomplete
Import Path Workaround
Exploring Available Types
To see what types are available:- Check the generated file: Open
docs/snippets/tsdocs/TypeInfo.jsxto browse all types - Use your IDE: Start typing
TypeInfo.and let autocomplete show available packages and types - Check the TypeScript declarations: Open
docs/snippets/tsdocs/TypeInfo.d.tsfor the full type structure
Properties
The name of the property or type being documented
The TypeScript type annotation (e.g.,
string, number, object, Array<string>)Human-readable description of what this property represents
Whether this property is required. Displays a red “required” badge when
trueWhether this property is deprecated. Displays an orange “deprecated” badge when
trueThe default value for this property, if any. Displayed below the description
Array of nested properties for complex types. Each item should be an object with the same structure as TypeTree props
Internal property for tracking nesting depth. Automatically managed by the component (don’t set manually)
Nested Objects
TypeTree automatically renders nested properties with expandable sections. This example demonstrates 3 levels of nesting, showcasing the auto-expansion behavior:Preview
- Level 1:
endpoint,authentication,retry(all expanded by default) - Level 2: Under
authentication:method,credentials,refreshToken; Underretry:maxAttempts,backoffMs,retryableErrors(all expanded by default) - Level 3: Under
credentials:clientId,clientSecret,scopes; UnderretryableErrors:network,timeout,serverError(expanded by default per auto-expansion rules)
Auto-Expansion Behavior
TypeTree automatically expands the first two levels of nesting for better discoverability:- Level 0 (root): Always visible
- Level 1: Expanded by default
- Level 2: Expanded by default
- Level 3+: Collapsed by default (user must click to expand)
Grouping Multiple Types
UseTypeTreeGroup to organize multiple related types:
Preview
Complex Type Examples
Union Types
Preview
Array Types
Preview
Generic Types
Preview
Function Types
Preview
Deprecated Properties
Mark deprecated properties with thedeprecated flag:
Preview
Optional vs Required
The component automatically displays badges for required and optional properties:Preview
Best Practices
Use Clear Descriptions
Use Clear Descriptions
Write descriptions that explain what the property does and why it exists, not just restating the type.
Include Default Values
Include Default Values
Always document default values to help users understand the expected behavior:
Organize Complex Structures
Organize Complex Structures
For very complex types with many properties, use TypeTreeGroup to create logical sections:
Keep Nesting Reasonable
Keep Nesting Reasonable
While TypeTree supports unlimited nesting, try to limit depth to 3-4 levels for readability. Consider breaking very deep structures into separate documentation pages.
Styling and Theming
TypeTree automatically adapts to Mintlify’s light and dark themes using Tailwind CSS:- Light mode: Uses gray borders and backgrounds
- Dark mode: Uses darker backgrounds with lighter borders
- Hover states: Subtle background changes on expandable items
- Badges: Color-coded for required (red), deprecated (orange), optional (gray)
Comparison with ParamField
TypeTree is designed as a cleaner alternative to deeply nested ParamField components:- TypeTree (Recommended)
- ParamField (Verbose)
- Single component declaration
- Easy to maintain
- Properties defined as data
- Built-in expansion logic
Auto-Generated Documentation
When usingmint-tsdocs to generate API documentation, TypeTree components are automatically created for complex type structures:
- The tool analyzes TypeScript types
- Extracts nested property information
- Generates TypeTree components with full type information
- Installs the component to your
docs/snippets/folder
Troubleshooting
Component not found
Component not found
If you see
Cannot find module "/snippets/TypeTree.jsx":- Ensure TypeTree.jsx exists in your
docs/snippets/folder - Run
mint-tsdocsto auto-install the component - Check that the import path is correct (should start with
/snippets/)
Properties not expanding
Properties not expanding
If nested properties don’t expand when clicked:
- Verify the
propertiesarray is properly formatted JSON - Check browser console for JavaScript errors
- Ensure each nested property has at least
nameandtypefields
Styling issues
Styling issues
If the component doesn’t look right:
- Ensure Tailwind CSS is properly loaded in your Mintlify site
- Check that you’re using an up-to-date version of the component
- Try refreshing the page to reload styles
Version History
v1.0.0
Initial release with full recursive rendering support
Future
- Syntax highlighting for code examples
- Copy-to-clipboard for type definitions
- Collapsible all/expand all controls

