@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
22 lines (19 loc) • 725 B
JavaScript
'use client';
import { useTypesDataContext } from "./TypesDataContext.mjs";
/**
* Props passed to the custom `typePropRefComponent` element.
*/
/**
* Hook to look up a single type property's data from the nearest `TypesDataProvider`.
*
* Returns the `TypePropData` for the given type and property name, or `undefined` if:
* - No `TypesDataProvider` is present in the tree
* - The type or property has not been registered
*
* @param typeName - The type name (e.g., "Root", "Trigger")
* @param propName - The property name (e.g., "className", "defaultOpen")
*/
export function useTypeProp(typeName, propName) {
const context = useTypesDataContext();
return context?.typeProps.get(`${typeName}:${propName}`);
}