Skip to content

Function: useSlot()

ts
function useSlot<D, N>(slot: N, slots: any): D[N] | undefined;

Retrieves a slot from the slots object with proper typing.

Type Parameters

Type ParameterDefault typeDescription
D extends Record<string, Slot>Record<string, Slot>The slot definitions record type
N extends string | number | symbolkeyof DThe slot name

Parameters

ParameterTypeDescription
slotNThe slot name to retrieve
slotsanyThe slots object from the component

Returns

D[N] | undefined

The slot function or undefined if not provided