Skip to main content
Version: 2023.1


Home > @genesislcap/foundation-layout > FoundationLayout > registerItem

FoundationLayout.registerItem() method

Register a collection of Element and associate them with an ID with the layout system for later use.


registerItem(registration: string, elements: Element[]): string;


registrationstringstring of the registration ID
elementsElement[]Elements[] containing the reference to the elements to register for later usage



  • string defining the name of the registered item with the layout system ( if set).


LayoutUsageError if you attempt to add an item before the layout has been initialised.

LayoutRegistrationError if you attempt to use a registration name which is already in use (declarative html API and JavaScript API registrations use the same "pool" of registration names).


You would use this to register elements that you later want to load when using FoundationLayout.loadLayout(). Use FoundationLayout.layoutRequiredRegistrations() to see what components need to be registered for a certain config and then register them using this function before calling FoundationLayout.loadLayout().

When registering an element it is moved by reference into the internals of the layout, so if you pass elements already in the DOM then they will disappear. If you want to avoid this you can pass copies using element.cloneNode(true).