- Reducing the time from first paint to visitor interaction.
- Improving page speed and SEO, including First Contentful Paint, Time to Interactive, and Cumulative Layout Shift scores.
- The ability to customize hydration behavior per island, also known as progressive hydration.
Implementation
- Import
Islandfrom@hubspot/cms-components. - Import the module you want to wrap, adding
?islandto the end of the import URL. - Render the
Islandcomponent, passing the module name into themoduleprop. - Any serializable props that you want to pass to the module, excluding functions, can be passed as props in the
Islandcomponent.
Available props
Below are the availableIsland component props.
Hydration types
By default, the island initialization script will hydrate all islands as soon as possible (i.e., on load). But for more complex pages, you may want to defer hydration of non-critical page elements until the browser has finished all other work, or until the visitor scrolls down to the island. Using thehydrateOn prop, you can specify one of the following hydration behaviors:
load(default): hydrates the island on initial page load.idle: defers hydration by using the requestIdleCallback method. This can be useful for lower priority components, allowing client resources to be used first on higher priority items.visible: hydration won’t occur until the element is visible on screen by using the Intersection Observer API. This can be useful for components that aren’t immediately visible to the user on page load (i.e., elements farther down the page). For complex islands, this can provide a significant performance benefit: if the user never scrolls to see the island, it will never be loaded.