Type Definitions
All types are automatically included when you install the package. The package exports types at./dist/index.d.ts which are automatically resolved by TypeScript.
package.json
source/packages/components/package.json:8:
Component Prop Types
Every component exports its prop types for type-safe usage. All types are exported from the main package entry point.Accordion
Badge
Callout
Card
Code Block
CodeGroup
Icon
Steps
Tabs
Tooltip
Complete Type Exports
Here’s a comprehensive list of all exported types from the package:- Component Types
- Utility Types
Type-Safe Variants
Many components use discriminated unions for type-safe variant props:Using the cn Utility
Thecn utility function combines clsx and tailwind-merge for intelligent class name merging:
Constants and Enums
Some components export constants for valid values:Generic Component Props
For components that accept generic React props:Type Inference
TypeScript can infer types from usage:Utility Type Helpers
Create helper types for common patterns:Working with Children
Type children props correctly:tsconfig.json Configuration
Recommended TypeScript configuration for working with the library:tsconfig.json
Type-Safe Component Composition
Build type-safe wrapper components:Advanced Pattern: Typed Component Factories
Troubleshooting
Type errors after installation
Type errors after installation
- Ensure TypeScript version is 5.0 or higher
- Run
npm installto ensure types are properly installed - Restart your TypeScript language server (in VS Code: Cmd+Shift+P → “Restart TS Server”)
- Check that
node_modules/@mintlify/components/dist/index.d.tsexists
Cannot find module or type declarations
Cannot find module or type declarations
Check that:
@mintlify/componentsis in yourdependencies(notdevDependencies)- Your
moduleResolutionis set tobundler,node16, ornodenextintsconfig.json - You’re importing from
@mintlify/components(not from a subdirectory)
Prop types not autocompleting
Prop types not autocompleting
Make sure you’re importing types correctly:The
type keyword is recommended for type-only imports for better tree-shaking.IconType or IconLibrary not found
IconType or IconLibrary not found
These types are exported from the main package:They’re defined in
source/packages/components/src/utils/icon-utils.ts.Next Steps
Tailwind Integration
Set up Tailwind CSS with the components
Dark Mode
Configure dark mode theming