useComponent
useComponent<
K>(slot):UIPluginComponents[K]
Defined in: packages/ui/src/plugin.tsx:119
Resolves a component for a given UIPluginComponents slot.
Looks up the slot in the current UIPlugin (via useUIPlugin). If the plugin provides an implementation for the slot, that component is returned. Otherwise, the headless HTML default is returned. This ensures every component renders correctly even without a UI plugin installed.
Type Parameters
Section titled “Type Parameters”K extends keyof UIPluginComponents
The slot key from UIPluginComponents.
Parameters
Section titled “Parameters”K
The component slot name to resolve (e.g., "button", "table", "chip").
Returns
Section titled “Returns”The component implementation for the given slot.
Example
Section titled “Example”function MyComponent() { const Button = useComponent("button"); const Chip = useComponent("chip");
return <Button onClick={handleClick}>Click me</Button>;}