find_component_usages
Find all JSX usages of a component across the codebase. Supports filtering by props, patterns, conditional rendering, and parent components for precise analysis.
Instructions
Find all JSX usages of a component across the codebase. Returns summary (totalUsages, filesCount), distribution by path, and limited usages with detailed prop info. Supports filtering by props (withProp, withoutProp, withPropValue), patterns (hasInlineHandler, hasSpreadProps), and conditional rendering.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max usages to return (default: 10, max: 50) | |
| exclude | No | File patterns to exclude (default: ["**/node_modules/**"]) | |
| include | No | File patterns to include (default: ["**/*.tsx", "**/*.jsx"]) | |
| filePath | No | Filter to specific file or folder path (e.g., "src/app/sections/") | |
| withProp | No | Only usages that have this prop (e.g., "onClick", "disabled") | |
| projectPath | Yes | Root path of the project (must contain tsconfig.json or source files) | |
| withoutProp | No | Only usages that do NOT have this prop | |
| componentName | Yes | Component name to search for (e.g., "Button", "DataGrid") | |
| withPropValue | No | Only usages where prop has specific value (e.g., variant="danger") | |
| hasSpreadProps | No | Filter by presence of spread props (e.g., {...props}) | |
| onlyConditional | No | Only usages inside conditional expressions (ternary, &&, etc.) | |
| parentComponent | No | Filter to usages within specific parent component | |
| hasInlineHandler | No | Filter by presence of inline arrow function handlers (e.g., onClick={() => ...}) | |
| includeExportChain | No | Include component definition and export chain (default: false) |