UNPKG

@slashid/react

Version:

React SDK for the /id platform

25 lines 1.39 kB
import React from "react"; import { MaybeArray } from "../../domain/types"; export type Props<Name extends string> = { children: React.ReactNode; name: Name; }; export type Slots<SlotNames extends string> = MaybeArray<React.ReactElement<React.JSXElementConstructor<React.PropsWithChildren<Props<SlotNames>>>>>; /** * Fill a named slot with the components passed as children. This is a layout concept entirely - no business logic is associated with this component. * If a parent component exposes a named slot, it will also be responsible for rendering a default component in case no component is passed to the slot. * Slot itself does not pass any props or share state with child components. * Check the docs of the parent component to see if it exposes any stateful components you can use. */ export declare function Slot<N extends string>({ children, name }: Props<N>): import("react/jsx-runtime").JSX.Element; type PopulateSlotsOptions = { children: React.ReactNode; defaultSlots: Record<string, React.ReactNode | null>; }; /** * Given a list of slots with their default components, populate the slots with the components passed as children. * Ensures a component gets rendered in place of the slot. */ export declare function useSlots({ children, defaultSlots }: PopulateSlotsOptions): Record<string, React.ReactNode>; export {}; //# sourceMappingURL=index.d.ts.map