UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

13 lines (12 loc) 632 B
import React from 'react'; export type SlotConfig = Record<string, React.ComponentType<any>>; type SlotElements<Type extends SlotConfig> = { [Property in keyof Type]: React.ReactElement<React.ComponentPropsWithoutRef<Type[Property]>, Type[Property]>; }; /** * Extract components from `children` so we can render them in different places, * allowing us to implement components with SSR-compatible slot APIs. * Note: We can only extract direct children, not nested ones. */ export declare function useSlots<T extends SlotConfig>(children: React.ReactNode, config: T): [Partial<SlotElements<T>>, React.ReactNode[]]; export {};