@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
21 lines (18 loc) • 601 B
JavaScript
'use client';
import { useTypesDataContext } from "./TypesDataContext.mjs";
/**
* Props passed to the custom `typeRefComponent` element.
*/
/**
* Hook to look up a single type's data by name from the nearest `TypesDataProvider`.
*
* Returns the `TypeData` for the given name, or `undefined` if:
* - No `TypesDataProvider` is present in the tree
* - The type name has not been registered
*
* @param name - The type name to look up (e.g., "Root", "Trigger", "AccordionTrigger")
*/
export function useType(name) {
const context = useTypesDataContext();
return context?.types.get(name);
}