UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

20 lines 767 B
import type { WithSlotMarker } from './types'; /** * Copies the `__SLOT__` marker from a slot-aware source component onto another * component, returning the same component reference typed as a slot. * * Useful when building reusable wrappers around Primer slot components that * still need to be recognised by the parent's slot scanner. * * @example * ```tsx * const ColoredLeadingVisual = asSlot( * function ColoredLeadingVisual({color, children}) { * return <ActionList.LeadingVisual><span style={{color}}>{children}</span></ActionList.LeadingVisual> * }, * ActionList.LeadingVisual, * ) * ``` */ export declare function asSlot<T>(component: T, slotSource: WithSlotMarker<unknown>): WithSlotMarker<T>; //# sourceMappingURL=as-slot.d.ts.map