Table Of Contents

Considerations When Creating UI Elements with JavaScript

Last Modified: November 16, 2020

JavaScript UI elements may require special sizing considerations to ensure they appear correctly after you deploy your web application or share the UI element in a library.

The size of the UI element you create can change if your web application has a flexible layout or if your user configures the element using property nodes. Consider using the following strategies to ensure the UI element retains the appropriate size to fit in the Placeholder HTML Container.
  • Configure with CSS—Use a style sheet to set the size of the UI element.
  • Configure with the ResizeObserver API—Use the browser-based ResizeObserver API to make adjustments programmatically.
    spd-note-note
    Note  

    The ResizeObserver API is supported in most browsers. Ensure your browser supports this API before implementing it in your code. Refer to the Mozilla Developer Network documentation for more information about the ResizeObserver API.


Recently Viewed Topics