Returns a custom element DOM node for the given type that you can embed anywhere on your site.

Example

var target = document.getElementById('button-component-target');
var searchCmpnt = window._elev.component({ type: 'search' });
document.getElementById('search-container').appendChild(searchCmpnt);

Signature

window._elev.component(options);

options (required)

options.type (required)

  • addon
    Requires id option set to module ID of addon.
    See styling in notes below.
  • article
    Requires id option set to article ID.
  • article-feedback
    Requires id option set to article ID.
  • article-related
    Requires id option set to article ID.
  • category
    Requires id option set to category ID.
  • iframe
    Requires id option set to module ID of iframe.
    See styling in notes below.
  • menu
  • search
  • suggestions

options.id

Some types require an associated ID. See above.


Notes

  • Removing the node from the DOM will destroy the component. It can no longer be used. To get another one simply call this API again.
  • Styling options are limited for now. You can use the CSS classes at your own risk; they may change over time.
    • addon and iframe types require a parent element with height and width. For example:
      • <div style=”width: 500px; height: 500px;”></div>
  • This API has the same result as elevio-element (a custom element DOM node). Note that neither are specification compliant.
If you use this API or have suggestions for it’s improvement please get in touch about your experience.

See also

  • elevio-element
  • buttonComponent
  • popupComponent