Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/docs/src/en/directives/cloak.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sometimes, when you're using AlpineJS for a part of your template, there is a "b
For `x-cloak` to work however, you must add the following CSS to the page.

```css
[x-cloak] { display: none !important; }
[x-cloak=""] { display: none !important; }
```

The following example will hide the `<span>` tag until its `x-show` is specifically set to true, preventing any "blip" of the hidden element onto screen as Alpine loads.
Expand All @@ -21,6 +21,12 @@ The following example will hide the `<span>` tag until its `x-show` is specifica
<span x-cloak x-show="false">This will not 'blip' onto screen at any point</span>
```

You can also disable the cloaking by setting the attribute to any non-empty string. This is helpful when you have an element that you know will be visible immediately and don't want it to "blip" in.

```alpine
<span x-cloak="off" x-show="true">This will show immediately</span>
```

`x-cloak` doesn't just work on elements hidden by `x-show` or `x-if`: it also ensures that elements containing data are hidden until the data is correctly set. The following example will hide the `<span>` tag until Alpine has set its text content to the `message` property.

```alpine
Expand Down