Skip to content

Interface SlotSystem<C> ​

Source: slots.tsx

System that allows you to create root components and slot components.

See ​

createSlots

Type Parameters ​

C ​

C

The type of the context value.

Properties ​

useSlotsContext ​

useSlotsContext: () => C

A hook that returns the current context value from the SlotsProvider.

Returns ​

C

Throws ​

If called outside of a SlotsProvider.


SlotsProvider ​

SlotsProvider: <S>(props: SlotsViewProps<S> & { context: C; }) => ReactNode

Renders the slots or children with the given context value.

Usually placed inside a root component that accepts the props specified by PropsWithSlots and passes them to this component.

If props.children is not an empty value, they are rendered instead of the slots.

Type Parameters ​

S ​

S extends Record<string, FC>

A dictionary mapping each slot name to a component.

Parameters ​

props ​

SlotsViewProps<S> & { context: C; }

Returns ​

ReactNode

Built by Prozilla