Delayed Rendering: x-cloak

Learn to use x-cloak to hide elements before AlpineJS is loaded.

The x-cloak directive

We use the x-cloak to delay the rendering of elements until AlpineJS has fully loaded. In some of the examples from the previous lessons, some elements were flickering before AlpineJS loaded. We can prevent flickering by using the x-cloak directive. In doing so, x-cloak will hide the element until AlpineJS has completely loaded. We use x-cloak like other AlpineJS directives. However, we don’t provide value to it.

Get hands-on with 1200+ tech skills courses.