Skip to content

pi-slot API

Attributes

NameNotesDescription
nameName of the components to look for
dataThe data to forward to the components ("props")
rel(1)The behavior of the slot
item-template-idThe ID of a template to wrap each found component
fallback-template-idThe ID of a template to display as fallback
order-by(2)Defines the ordering of the found components
reverse-orderIf set, reverses the order in which the components are displayed

(1) The slot behavior defines the slot's relationship to a Picard.js-internal service that is responsible for actually matching the name and the data props. Initially, a single behavior named router is available. This behavior matches the provided name as a page:-component using dynamic route matching.

(2) The ordering key must be one of cid (order by their component ID), origin (order by their micro frontend name), time (order by the time the component was registered), and none (just take the order in which the components have been found - usually equivalent to time and the default value).

Properties

NameNotesDescription
nameGets or sets the name attribute
dataGets or sets the deserialized data ("props")

The serialized data is understood as a JSON string. It is deserialized using JSON.parse. Make sure to only provide valid objects here, otherwise the data will be discarded.

Events

NameArgumentsDescription
mounted-slotMountedSlotEventCalled when the slot was fully mounted
unmounted-slotUnmountedSlotEventCalled when the slot was fully unmounted

All events are emitted through the Picard.js event system.

Interfaces

ts
interface MountedSlotEvent {
  /**
   * The corresponding HTML element.
   */
  element: HTMLElement;
}
ts
interface UnmountedSlotEvent {
  /**
   * The corresponding HTML element.
   */
  element: HTMLElement;
}

Released under the MIT License.