Considerations When Creating UI Elements with JavaScript
- Updated2024-05-31
- 1 minute(s) read
Considerations When Creating UI Elements with JavaScript
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.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.